Home
Analytics
Adding a Search button and textbox to a report
hallj05
<p>Hey,</p>
<p> </p>
<p>We are using version 4.2.2 of BIRT.</p>
<p> </p>
<p>I'm trying to add the ability for the user to search through the results in a table.</p>
<p>To do this I need to add a text box and then a button which when clicked will refresh the current report and pass in the value from the text box as a report parameter? The button also needs the style that is used to match the rest of the UI.</p>
<p> </p>
<p>I currently have it working using something like this in a dynamic text field</p>
<p> </p>
<p><span style="font-size:10px;"><form method="POST" name="reportForm"><br>
<input type="hidden" name="__report" value="TEST.rptdesign" /><br>
<input type="text" name="rpFN_ID"><br>
<input type="submit" value="Search"<br>
style=" background-color: green;<br>
font-weight: bold;<br>
font-size: 8pt;<br>
font-family: Arial;<br>
border: outset medium;<br>
margin: 0;<br>
line-height: normal;<br>
vertical-align: middle;<br>
vertical-align: auto;<br>
text-align: center;<br>
white-space: nowrap;"/><br><br>
</form></span><br>
</p>
<p>The report parameter that is doing the filtering in the where statement in the data set is rpFN_ID.</p>
<p> </p>
<p>The only issue with doing it like this is that the button has a blue box around it (which normally would mean that it is in focus after tabbing to it) The way to fix this is to tab to it and then tab off it. It also gets this blue box when the text box is selected since it's in the same report item.</p>
<p> </p>
<p>I've tried to separate the button and text box but have not been able to get it to work correctly.</p>
<p> </p>
<p>Any ideas on how to do this separately and make it not get the blue box when not tabbed to?</p>
<p> </p>
<p> </p>
<p>Note: I've attached a screen shot showing the blue box that appears around the button, along with how it looks after I tab to the button and away from it.</p>
<p> </p>
<p>Thanks for any help</p>
Find more posts tagged with
Comments
Clement Wong
<p>Did you try using the CSS <strong>outline: 0; </strong>in the inline style of the Search input?</p>
<pre class="_prettyXprint">
<form method="POST" name="reportForm">
<input type="hidden" name="__report" value="TEST.rptdesign" />
<input type="text" name="rpFN_ID">
<input type="submit" value="Search"
style=" background-color: green;
font-weight: bold;
font-size: 8pt;
font-family: Arial;
border: outset medium;
margin: 0;
line-height: normal;
vertical-align: middle;
vertical-align: auto;
text-align: center;
outline: 0;
white-space: nowrap;"/>
</form></pre>
hallj05
<p>Just tried it, even with the outline set to 0 it still does it.</p>
hallj05
<p>Actually instead of filtering the results with the search button like I have been doing.</p>
<p> </p>
<p>Is there a way to make it find and highlight the next instance of the value typed in the text box? This would be like how search works in web browsers and word. </p>
<p> </p>
<p>The data that would be searched through would be in a table report item and it would only need to search the detail line records, which could be many pages long.</p>
shamo
<p>if the text box is a parameter, then you can use the highlighting with a condition referencing the parameter</p>
hallj05
<p>Is there a way to make it so that when I click the Search button on the report that the value in the text box becomes a report parameter? If so then I could make it refresh the table on the report with the values highlighted. Although I'd also have to figure out a way to make it go to the next value in the table each time the search button is clicked.</p>
JFreeman
<p>If you are going to rerun the report with the new parameter value from your text box, you can pass that value as a parameter through the URL when calling the report.</p>
<p> </p>
<p>Take a look a this example, it's not exactly what you are wanting but it shows using a list box to select values that are passed in to the report as parameters while rerunning the report: <a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/forum/index.php?/topic/36755-need-listbox-parameter-at-top-of-the-report/?p=137016'>http://developer.actuate.com/community/forum/index.php?/topic/36755-need-listbox-parameter-at-top-of-the-report/?p=137016</a></p>
;
hallj05
<p>It doesn't have to rerun the report, would actually be better if it didn't have to, although I'm not sure that it would be possible without rerunning the report.</p>
<p> </p>
<p>I mainly need to figure out a way to get make it so that when the search button is clicked that it goes to and highlights the next row in a table that the search value is in. I'm not too sure if this is possible in BIRT though.</p>
<p> </p>
<p>I could probably get the highlighting to work using a parameter to store the search value and set a highlight rule on the table, but as for the go to next entry I'm not sure how that would work.</p>
JFreeman
<p>One option would be to bookmark the table in the report design, the value set as the bookmark will be assigned as the table's id in the DOM tree. Then you can use javascript or jQuery client side to hook the table and iterate through it to find the desired row based on the value from the text box. Once you have hooked the desired row, you could then also use javascript or jQuery to assign a new background color to act as your highlighting.</p>
<p> </p>
<p>Take a look at these references on using jQuery in BIRT:</p>
<ul><li><a data-ipb='nomediaparse' href='
http://blogs.opentext.com/using-external-javascript-libraries-with-birt-jquery-jvectormaps/?show=newcomment'>http://blogs.opentext.com/using-external-javascript-libraries-with-birt-jquery-jvectormaps/?show=newcomment</a></li>
;
<li><a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/forum/index.php?/files/file/1125-jquery-and-open-source-birt/'>http://developer.actuate.com/community/forum/index.php?/files/file/1125-jquery-and-open-source-birt/</a></li>
;
<li><a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/forum/index.php?/files/file/915-dynamic-javascript-loader/'>http://developer.actuate.com/community/forum/index.php?/files/file/915-dynamic-javascript-loader/</a></li>
;
</ul>