Forum
14:41
07/10/2013
When the search window is opened, there is a dropdown to select the column to search. The order of the columns in the dropdown corresponds to the order of the columns in the grid. This is fine, but the default selection is the first column. 99.9% of the time, my users will change the column dropdown to the 3rd column. It would be more efficient if I could change the default dropdown selection to the 3rd column. How can I do this?
17:21
07/10/2013
Since there doesn't appear to be an easy way to change the default column listbox selection, i've implemented some convoluted code which does it:
var change_search_now = false;
// Change serach default from selection option to the one with value = '3' function changeSearchDefault(select){ select.children("option:selected").removeAttr("selected"); var newdefault = select.children("option[value='3']"); newdefault.attr("selected", "selected"); newdefault.trigger("change"); }
And in the jqGrid navGrid initialization:
onInitializeSearch: function(){ change_search_now = true; changeSearchDefault($('.columns').children("select")); $("#fbox_grid_main_reset").click(function(){ change_search_now = true; }); }, afterRedraw: function(){ if (change_search_now){ changeSearchDefault($('.columns').children("select")); change_search_now = false; } // Add "+" button click handlers to change search column default of newest search row item $("input[value='+']").each(function(inputindex){ $(this).click(function(){ $("input[value='+']").each(function(clickedindex){ if (clickedindex == inputindex){ // Change default changeSearchDefault($(this).closest('tr').siblings(":last").children(".columns").children("select")); } }); }); }); },
Most Users Ever Online: 715
Currently Online:
56 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