Page 1 of 1
Determine if Grid is filtered or not filtered
Posted: Tue Nov 15, 2016 10:51 am
by mwalter
Is there a way to determine if a grid has been filtered and then the filtered has been removed?
Re: Determine if Grid is filtered or not filtered
Posted: Tue Nov 15, 2016 12:22 pm
by matt.denninghoff
Yes, it is possible. You can use the grid's
onfilterchange event to detect when any filter is set or removed. You'd need to write your own custom code to detect which column was filtered.
You can detect if a column is currently filtered using the grid's
getFilterAPI method. You could loop over each column (starting at 0), and call getFilter on each to detect which has a filter.
Re: Determine if Grid is filtered or not filtered
Posted: Tue Nov 15, 2016 1:08 pm
by mwalter
Thanks Matt. This goes along with the previous question, is there a way to determine whether or not a row is selected.
Re: Determine if Grid is filtered or not filtered
Posted: Tue Nov 15, 2016 1:12 pm
by mwalter
Nevermind, I see the getSelectedRows api. My version of the documentation doesn't have this.
Re: Determine if Grid is filtered or not filtered
Posted: Thu Jun 08, 2017 12:38 pm
by amarschner@masters
I see that there is a getfilter(columindex) API to determine if a specific column has been filtered. Is there an API to determine if ANY column in the grid was filtered during a previous execution of the program? (persistent state in effect).
I.E. Upon entering a program, check if a previous execution left grid filtering in place.
Al Marschner
Masters Gallery Foods, Inc.
Re: Determine if Grid is filtered or not filtered
Posted: Thu Jun 08, 2017 1:38 pm
by Scott Klement
Hi Al,
No, there isn't an API that will tell you if any column is filtered. This should still be easy to do by calling the getFilter() API in a loop.
Pseudo code would be:
1. Retrieve the number of columns in the grid
2. Declare an isFiltered variable, set it to false
2. Loop from 0 to the number of columns - 1.
3. Call the getFilter() API for the column. If there's a filter, flip isFiltered to true.
4. Repeat loop for all columns
Haven't tried it, myself... but that's all you should need.
Re: Determine if Grid is filtered or not filtered
Posted: Fri Jun 09, 2017 8:19 am
by amarschner@masters
Thank you, Scott. I thought might be the case.