jQuery UI Widgets Forums Grid Duplicate "Select All" Options in Filter

This topic contains 8 replies, has 4 voices, and was last updated by  admin 5 years, 1 month ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
  • Duplicate "Select All" Options in Filter #89888

    kdisarno
    Participant

    For a certain page that has a grid on it, I comb through the $_GET’s looking to see if a particular value is set. If it is, I build the grid, (really its columns) with something like this:

    {
      text: 'Planner',
      datafield: 'PlannerCode',
      filtertype: 'checkedlist',
      filter: <?php echo isset($_GET['whatever']) ? 'BuildPlannerFilter()' : 'null'; ?>
    },

    … the function looks something like this…

    function BuildPlannerFilter()
    {
    	var filtergroup = new $.jqx.filter();
    	var filter_or_operator = 1;
    	var filtercondition = 'equal';
    
    	for(var i = 0; i < planners.length; i++)
    	{
    		var filter = filtergroup.createfilter('stringfilter', planners[i], filtercondition);
    		filtergroup.addfilter(filter_or_operator, filter);
    	}
    
    	return filtergroup;
    }

    The grid does indeed filter as expected, but 1) the checkboxes for those values are not checked, and, 2) the checkedlist has 2 x “(Select All)” at the top.

    Is this a bug? If not, what is the best process for initializing a grid with a filter?

    I have tried the following, but it didn’t work. I called it in the grid’s bindingcomplete, because it doesn’t appear to have any loaded/completed event.

    	$("#jqxgrid").jqxGrid('addfilter', "PlannerCode", filtergroup);
    
    	$("#jqxgrid").jqxGrid('applyfilters');
    
    Duplicate "Select All" Options in Filter #89907

    Hristo
    Participant

    Hello kdisarno,

    A better way to add filter is ready callback when the Grid is initialized.
    Please, take a look at this demo:
    http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/filtering.htm?light
    Also, I would like to suggest you one more example ‘Grid Server Filtering’ in the PHP section.

    Best Regards,
    Hristo Hristov

    jQWidgets team
    http://www.jqwidgets.com

    Duplicate "Select All" Options in Filter #90035

    kdisarno
    Participant

    I’ve got it working. Thanks Hristo!

    Just to follow up:

    1) The ready function was just what I was looking for. However…it’s really buried in there. I was expecting something like that to be in the Events section.

    2) Applying the filters in ready is so much easier than using filter on the columns property. I have about 20+ columns so that section gets really out of hand, and you’d still have the bug(?) of two “Select All”‘s at the top of the checkedlist filter.

    • This reply was modified 6 years, 9 months ago by  kdisarno.
    Duplicate "Select All" Options in Filter #90088

    Hristo
    Participant

    Hello kdisarno,

    Please, take a look at this example:
    https://www.jseditor.io/?key=grid-apply-filter

    Best Regards,
    Hristo Hristov

    jQWidgets team
    http://www.jqwidgets.com

    Duplicate "Select All" Options in Filter #91822

    fewr
    Participant

    Hallo,

    there is a bug in Version 4.5 (4.4 was ok) with “addfilter / applyfilters“.

    Select all“-filteritem is missing, if a column was setup by this way (like ready):
    $(“#jqxgrid”).jqxGrid(‘addfilter‘, “column”, filtergroup);
    $(“#jqxgrid”).jqxGrid(‘applyfilters‘);
    The first item get the behavior from “Select all”. Therefore it’s also impossible the select the first regular item.

    The way by columns[filter: filtergroup] works still again.

    Duplicate "Select All" Options in Filter #91919

    Hristo
    Participant

    Hello fewr,

    Could you provide an example that demonstrates this issue?
    I try the example above and it seems to work fine.

    Best Regards,
    Hristo Hristov

    jQWidgets team
    http://www.jqwidgets.com

    Duplicate "Select All" Options in Filter #91951

    fewr
    Participant

    Hi Hristo,

    the user mflach is also in trouble with the same bug and created such pictures 🙂
    http://www.jqwidgets.com/community/topic/loosing-the-select-all-option-in-row-filter/


    Hristo
    Participant

    Hello fewr,

    We created a work item for this case.
    Thank you for your understanding.

    Best Regards,
    Hristo Hristov

    jQWidgets team
    http://www.jqwidgets.com


    admin
    Keymaster

    The issue is planned for resolution for jQWidgets ver.6.0.7.

    Thank you all for the feedback.

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

You must be logged in to reply to this topic.