Setting the initial filter on filter tool bar for a column that has a select

Sunday, May 4, 2014

I have been trying to set the initial filter for a column called status over the past week to no avail.


In my searches, I used Oleg's code that shown below:



searchoptions:{
dataInit:function(elem){
$(elem).val("Test");
setTimeout(function(){
$(elem).focus().trigger({ type: 'keypress', charCode: 13 });
},500);
}
}


This works nicely if you replace the "Test" with a couple of letter and hit . However, my requirement is to initially show the records that have their "Status" equal to "Active" without having to hit the enter key at the initial load. After the initial load, the grid should respect the status settings: i.e. if the the status = "Active", only the active records to be displayed, if it is changed to "Closed", only the records with status = closed to be displayed and if it is "All", all records regardless of their status should be displayed.


I have replaced the "Test" with "Active", removed the setTimeout funciton from the code and set the searchOnEnter to false in order to enable the grid to follow the above requirements. However on the initial load, I get the "Active" displayed in the filter select box, but the column content is a mixed of the closed and Active records.


I have no ideas what am I missing and how to go about fixing this.


I appreciate any help you may be able to provide.


Regards Nasser (ossareh.n@gmail.com)


P.S. I have also used Oleg's postData code samples but the problem is that the status sticks. So even if you change it to Closed, any refresh will switch the status back to Active.







http://ift.tt/1oidPVr