jQuery UI Widgets › Forums › Grid › Remove sorting and filtering applied on columns at once
Tagged: filter, grid, hidden column, hidecolumn, jqxGrid ;, remove, remove sort and filtering, showcolumn, sort
This topic contains 19 replies, has 6 voices, and was last updated by anichifor3pg 1 year, 3 months ago.
-
Author
-
Hello Team,
We are testing the non-commercial Jqx grid functionality to procure a license but we are facing a problem while trying to remove sort and filtering applied on column before calling show/hide column method so that the if we remove an optional column then the sorting/filtering applied on the optional column should not effect the grid data.
But we are facing following problems
1. Either only sorting or filtering is removed but not both
2. The show/hide column is not working while calling both “removesort” and “clearfilters” as we are seeing a below error in consoleuncaught Error: jqxGrid: The data is still loading. When the data binding is completed, the Grid raises the ‘bindingcomplete’ event. Call this function in the ‘bindingcomplete’ event handler.
a.extend.sortby
a.extend.removesort
a.jqx.invoke
a.jqx.jqxWidgetProxy
(anonymous function)
n.extend.each
n.fn.n.each
a.jqx.jqxWidget.a.fn.(anonymous function)
(anonymous function)
n.event.dispatch
n.event.add.r.handlePFB for the code snippet.
$('#grid-data').jqxGrid("removesort"); $('#grid-data').jqxGrid("clearfilters"); $('#optionalColumns input:checked').each(function (key, value) { $("#grid-data").jqxGrid('showcolumn', value.value); }); $('#optionalColumns input:not(:checked)').each(function (key, value) { $("#grid-data").jqxGrid('hidecolumn', value.value); });
could you please let us know what can be done to achieve our need.
Many thanks
Hello Ram,
Sorted and filtered of hidden columns affect the grid. Could you, please, provide us with an example (preferably a JSFiddle) we can test locally to reproduce this issue?
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/Hi Dimitar,
Thanks for the response. We have created a JS Fiddle sample which will resemble our functionality.
Here is the sample : http://jsfiddle.net/9udLb2z7/
But in the sample it seems to be working as it’s local data source. When we are trying to implement the same on the server side then we are getting the error I mentioned in the post.
So could you please suggest us a way how could we achieve removing both sort and filter applied on grid before show/hide column
Many thanks
Hi Ram,
This is the correct approach. It should work for both local and external data sources. If the issue occurs only on your side, you may be using an old version of jQWidgets. Please make sure you have updated to version 3.6.0.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/Hi Dimitar,
We have tried with version 3.6.0 as well but still we could not able to proceed.
PFB for the steps we have implemented (Assumption: Serverside processing)
1. Grid having 10 columns and we are having a checkbox list for 5 more optional columns.
2. We have added one optional column using showcolumn method and applied both sorting and filtering on the optional column
3. Then we removed the optional column using hidecolumn method and before calling hidecolumn, we have called both clearfilters and removesort in the order.
4. Only filtering gets cleared and we are getting the above error in console instead of sort removal on the grid and sometimes even the hidecolumn is not working because of the error.Could you please provide an workaround as we are stuck with this for quite long.
Many thanks
Hello Dimitar
Can I have any solution please?
Many thanks
Hi Ram,
Please make sure you have correctly implemented your code for server-side filtering and sorting. It may be what causes the issue to occur. As a reference, you can take a look at the various demos and examples available.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/Hi Dimitar,
Thanks for the reply.
It’s because we are doing both “clearfilters” and “removesort” calls sequentially and they are clashing on the same grid. Could you please suggest what could be done here?
Hi Ram,
You can try calling the second method with a delay (in a setTimeout function).
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/Hello Dimitar,
We have tried it but no luck still we are getting same error. Could you please let us know is there any method that will clear both filters and sort applied on the grid?
Many thanks
Hi Ram,
Unfortunately, there is no such method in jqxGrid’s API. Another thing you can try is resetting the grid’s source property to its initial value, i.e.:
$('#jqxGrid').jqxGrid({ source: dataAdapter });
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/Is there any effort to fix this bug? It is almost 1.5 years old.
I am trying to call “clear”, then “clearfilters”, then “removesort” without having to “destroy” and reinitialize.
Hi mcfloyd,
If you are referring to the error “jqxGrid: The data is still loading. When the data binding is completed, the Grid raises the ‘bindingcomplete’ event. Call this function in the ‘bindingcomplete’ event handler.”, this is not a bug, but an error thrown to prevent initiating one server-side request before another one has been completed. Our suggestion is to call one method (clearfilters) and then call the other one (removesort) on the bindingcomplete event. This way, the error will not be thrown, because by the time you try to remove the sorting, the filtering will already have been cleared.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/I guess I am asking whether it would be possible to implement a new function within jqxGrid() to clear all without initiating a new AJAX call back to the server. I am controlling three grids with a search box, but two of the grids are dependent on a click action for the first grid, which means when a new search is entered, the data in the two other grids becomes invalid. So I would want to “clearall”, so that when the first grid is rendered a second time and cell clicked, then the two other grids do not still have filters/sorts applied.
I can deal with this for now as it is currently an edge case, but I think your suggestion of the bindingcomplete callback is a bad idea as it may cause issues with the valid grid data being applied, unless I added some messy code to track different stages of the grid rendering.
Hi mcfloyd,
You can also try the suggestion from this post: http://www.jqwidgets.com/community/topic/remove-sorting-and-filtering-applied-on-columns-at-once/#post-64586. This is currently all we can offer on the matter.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.