Determine if Grid is filtered or not filtered

Use this board to ask questions or have discussions with other Rich Displays users.
Post Reply
mwalter
Experienced User
Posts: 140
Joined: Wed Sep 14, 2016 2:58 pm
First Name: Mark
Last Name: Walter
Company Name: Paragon Consulting Services
Contact:

Determine if Grid is filtered or not filtered

Post by mwalter »

Is there a way to determine if a grid has been filtered and then the filtered has been removed?
User avatar
matt.denninghoff
Profound Logic Staff Member
Posts: 115
Joined: Wed Feb 10, 2016 3:53 pm
First Name: Matthew
Last Name: Denninghoff
Company Name: Profound Logic Software
State / Province: Ohio
Country: United States
Contact:

Re: Determine if Grid is filtered or not filtered

Post 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.
mwalter
Experienced User
Posts: 140
Joined: Wed Sep 14, 2016 2:58 pm
First Name: Mark
Last Name: Walter
Company Name: Paragon Consulting Services
Contact:

Re: Determine if Grid is filtered or not filtered

Post by mwalter »

Thanks Matt. This goes along with the previous question, is there a way to determine whether or not a row is selected.
mwalter
Experienced User
Posts: 140
Joined: Wed Sep 14, 2016 2:58 pm
First Name: Mark
Last Name: Walter
Company Name: Paragon Consulting Services
Contact:

Re: Determine if Grid is filtered or not filtered

Post by mwalter »

Nevermind, I see the getSelectedRows api. My version of the documentation doesn't have this.
amarschner@masters
New User
Posts: 13
Joined: Wed Jun 15, 2016 12:48 pm
First Name: Al
Last Name: Marschner
Company Name: Masters Gallery Foods, Inc.
Phone: 920-893-9100 x670
Address 1: 411 Cty Hwy PP
City: Plymouth
State / Province: Wisconsin
Zip / Postal Code: 53073
Country: United States
Contact:

Re: Determine if Grid is filtered or not filtered

Post 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.
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Determine if Grid is filtered or not filtered

Post 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.
amarschner@masters
New User
Posts: 13
Joined: Wed Jun 15, 2016 12:48 pm
First Name: Al
Last Name: Marschner
Company Name: Masters Gallery Foods, Inc.
Phone: 920-893-9100 x670
Address 1: 411 Cty Hwy PP
City: Plymouth
State / Province: Wisconsin
Zip / Postal Code: 53073
Country: United States
Contact:

Re: Determine if Grid is filtered or not filtered

Post by amarschner@masters »

Thank you, Scott. I thought might be the case.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests