Forum
22:40
04/04/2014
I think I solved my own problem, but there might be a better way to do this.
I defined my grid like normal and then added a call to searchGrid. Additionally, I want to search on fields not included in my grid, exactly, so I added a column array.
HTML
<div class="inherit-bradius-top ui-widget-header ui-helper-clearfix" style="border:none;">
<span class="ui-jqdialog-title floatleft"> Search</span></div>
<div class="ui-jqdialog-content">
<div>
<div class="searchFilter" id="fbox_grid-table"></div>
<table id="fbox_grid-table_2" style="border:0px none;margin-top:5px" class="EditTable">
<tr><td colspan="2"><hr style="margin:1px" class="ui-widget-content"></td></tr>
<tr><td style="text-align:left" class="EditButton"><a class="fm-button ui-state-default ui-corner-all fm-button-icon-left ui-search" id="fbox_grid-table_reset"><span class="ui-icon ui-icon-arrowreturnthick-1-w"></span>Reset</a></td>
<td class="EditButton"><a class="fm-button ui-state-default ui-corner-all fm-button-icon-right ui-reset" id="fbox_grid-table_search"><span class="ui-icon ui-icon-search"></span>Find</a></td></tr>
</table>
</div>
</div>
</div>
JS
… // define as usual
})
.navGrid('#grid-pager', {add:false, edit:false, view:false, del:false, search:false, refresh:true, cloneToTop: true},
{}, // use default settings for edit
{}, // use default settings for add
{}, // delete instead that del:false we need this);
{}
)
.searchGrid({closeOnEscape:false, multipleSearch:true, searchOnEnter:true, columns: [
$('#grid-table').getColumnByName('visit_date'), // get grid column data
$('#grid-table').getColumnByName('user_str'),
{name:'c.name',index:'c.name',label:'Customer'}, // create column def
{name:'s.name',index:'s.name',label:'Site'}]
});
$.jgrid.hideModal('#searchmodfbox_grid-table');
Now my advanced search is displaying on page load.
13:12
Moderators
30/10/2007
Hello,
Thank you very much for sharing this usefull script.
Kind Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
Most Users Ever Online: 715
Currently Online:
45 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66