Open Excel Filter from outside the GridGroupingControl
Hello,
I want to be able to open the Excelfilter for a specific column from outside the GridGroupingControl, is this possible?
Example: Press a button outside the GridGroupingControl and the ExcelFilter for Columns(0) would popup, I would do the filter and press Ok, and the Column would be filtered.
SIGN IN To post a reply.
3 Replies
AR
Arulpriya Ramalingam
Syncfusion Team
February 24, 2020 04:27 PM UTC
Hi Henrik,
Greetings from Syncfusion.
The reported scenario can be achieved by invoking the click event on the ExcelFilterCell’s icon using the FakeLeftMouseClick of the ActiveXSnapshot. The point of the filter icon can be retrieved by using the RangeInfoToRectangle method. Please make use of the below code and sample.
Example code
|
//gridGroupingControl1.Focus();
Rectangle rect = gridGroupingControl1.TableControl.RangeInfoToRectangle(GridRangeInfo.Cell(gridGroupingControl1.TableControl.TopRowIndex - 1, 1));
//To find the mid position of the icon since, its width and height are 15 and aligned at the center based on row height.
Point point = new Point(rect.X + gridGroupingControl1.TableDescriptor.Columns[0].Width - 8, rect.Y + 15);
ActiveXSnapshot.FakeLeftMouseClick(gridGroupingControl1.TableControl, point); |
Sample link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/ExcelFilter1320887103
Please get back to us, if you have any other queries.
Regards,
Arulpriya
HT
Henrik Tegman
February 25, 2020 08:08 AM UTC
Hello Arulpriya,
Thanks for the help.
I tried this and at first it did not work it would just sort the list instead of open the Filter, but after I changed the -8 to -5 it worked as I thought that maybe the position was a little more to the right.
But there is still a problem if a user ever sorts the list then there will be a small sort arrow in the position of the filter icon and then this still won't work since the fakeclick will be on that arrow.
Another thing that I forgot to mention is that if possible I would also like to hide the filtericon. Since this solution works with doing a fakeclick I guess that will be hard, unless it can be made hidden but still work?
AR
Arulpriya Ramalingam
Syncfusion Team
February 26, 2020 01:13 PM UTC
Hi Henrik,
Thank you for the update.
We have validated the possibilities to popup the ExcelFilter dialog programmatically without the icon in a generic manner. However, in our previous update, we retrieved the rectangle based on our internal implementation which could not be workaround in sample level in a generic manner since, we maintained the rendering for filter icon internally. So, we regret to let you know that the GridGroupingControl does not have the support to show the filter popup dynamically.
Please get back to us, if you have any other queries.
Regards,
Arulpriya
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
HT Henrik Tegman
- Feb 21, 2020 09:25 AM UTC
- Feb 26, 2020 01:13 PM UTC