jQuery UI Widgets Forums Grid Dynamic Grid Filter on Page Load

This topic contains 2 replies, has 2 voices, and was last updated by  bradsolves 7 years, 10 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • Dynamic Grid Filter on Page Load #69273

    bradsolves
    Participant

    I have a grid with a “checkedlist” filter type that works when the grid is loaded with no filter applied. The filter also works when it is applied manually. Unfortunately, when the grid is loaded through the “addfilter” function, the “LOADING” box does not disappear. The “addfilter” function I am using is generated dynamically using server-side variables, and is posted below

    <?php
    	if(isset($posted_status) AND $posted_status <> NULL AND $posted_status <> '' AND $posted_status <> 'undefined') {
    		?>
    		var addfilter = function () {
    			var filtergroup = new $.jqx.filter();
    			var filter_or_operator = 1;
    			var filtervalue = '<?php echo $posted_status; ?>';
    			var filtercondition = 'equal';
    			var filter1 = filtergroup.createfilter('stringfilter', filtervalue, filtercondition);
    
    			filtergroup.addfilter(filter_or_operator, filter1);
    			
    			// add the filters.
    			$("#pp-highvaluegrid").jqxGrid('addfilter', 'status', filtergroup);
    			// apply the filters.
    			$("#pp-highvaluegrid").jqxGrid('applyfilters');
    		}
    		$("#pp-highvaluegrid").on("initialized", function () { addfilter(); }); 
    		<?php
    	}
    ?>

    Additionally, I am using jQuery 1.11.2 and jQWidgets v3.7.1. This problem does not exist in previous versions (v3.0.2 for example), but there are other bugs in that version that prohibit my simply downgrading.

    Thank you very much for any help you can provide.

    • This topic was modified 7 years, 10 months ago by  bradsolves. Reason: fixed tabbing in code sample
    Dynamic Grid Filter on Page Load #69299

    Dimitar
    Participant

    Hello bradsolves,

    We suggest you apply your filter in the grid’s ready callback function, which is called when the grid is initialized. There is also currently no initialized event in the jqxGrid API.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    Dynamic Grid Filter on Page Load #69445

    bradsolves
    Participant

    Thank you Dimitar. That worked perfectly.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.