jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Duplicate "Select All" Options in Filter
Tagged: addFilter, applyfilters, missing, select all
This topic contains 8 replies, has 4 voices, and was last updated by admin 6 years, 8 months ago.
-
Author
-
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');
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 HristovjQWidgets team
http://www.jqwidgets.comI’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 theEvents
section.2) Applying the filters in
ready
is so much easier than usingfilter
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.Hello kdisarno,
Please, take a look at this example:
https://www.jseditor.io/?key=grid-apply-filterBest Regards,
Hristo HristovjQWidgets team
http://www.jqwidgets.comHallo,
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 (likeready
):
$(“#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.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 HristovjQWidgets team
http://www.jqwidgets.comHi 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/Hello fewr,
We created a work item for this case.
Thank you for your understanding.Best Regards,
Hristo HristovjQWidgets team
http://www.jqwidgets.comThe issue is planned for resolution for jQWidgets ver.6.0.7.
Thank you all for the feedback.
-
AuthorPosts
You must be logged in to reply to this topic.