c# - jqGrid: Help displaying current search to user. -


i have jqgrid , need able display current search that's being performed on grid. use navgrid give users options filter through what's been pulled , i'd able show users current filters being applied data. have label on page , javascript grabs current queries , displays onsearch:

function setcurrentfilters () {     var currentfilters = $('#datamanagementgrid').getgridparam("postdata").filters;      document.getelementbyid("lblcurrentfilters").innerhtml = currentfilters; } 

it displays json:

{"groupop":"and","rules":[{"field":"isactive","op":"eq","data":"true"},{"field":"lastmodifiedby","op":"cn","data":"cheese"}]}

my question is, there better route? or should work json?

you can parse json , read field name/value , show in html. idea, not solution though :

function setcurrentfilters () {     var currentfilters = $('#datamanagementgrid').getgridparam("postdata").filters;        var htmlstring='';       var data = $.parsejson(currentfilters);      $.each(data.rules, function(idx, obj) {        htmlstring += obj.field + ' ' + obj.op + ' ' + obj.data + '<br />;     });      document.getelementbyid("lblcurrentfilters").innerhtml = currentfilters; } 

apply logic in loop check kind of operator there , want show i.e. eq ' = ' etc.


Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -