Hello all,
I have the following scenario, we have a grid with many cols where we have text and icons.
The icons is added by using cell..Appearance.Image, and the text is the cell value (please see the image below).
Users want the option to filter by image, but keeping also the option to filter by text, is this possible to achieve?
Thank you so much
Hello,
I have been looking into your requirement and found this forum thread where a similar question has been discussed. Also please take a look at the attached sample with a creation filter that you might consider useful.
Let me know if I may be of any further assistance.
Sincerely,
Teodosia Hristodorova
Associate Software Developer
Hello Teodosia, this case is different and I can't see how to change it to match my case. Actually in or applications we already have image only cells that we filter. What we have now is a cell with text and image, both in the same cell and user want to filter that same cell by the image it has associated or by the text in the cell (See the image in the original post)
Thank you
So, looking at your screen shot, you seem to have the same image applied to multiple values. So it's hard for me to answer your question because I don't know what criteria you are using for your images here. You cannot filter by an image, because images are not comparable. You cannot, in C# or VB compare one image to another - at least not in any easy or reasonable way.
So whatever fiter you were to apply here would have to be based on some kind of value in the cell or row.
Also, the user obviously has no way to enter an image into the filter cell via the keyboard - so the image would have to appear on the dropdown list.
So.. what you could do here is handle the BeforeRowFilterDropDownPopulate event (or possibly AfterRowFilterDropDownPopulate). This event gives you the ValueList that the grid shows for the filter list dropdown. You could add a couple of items to this list and assign whatever text you want and also the appropriate image. So the user could then pick an image from the list.
To perform the actual filtering, what you do is you create a class that derives from FitlerCondition and overrides the MeetsCriteria method. You assign this as the DataValue of the ValueListItem on the list. So when the user chooses that condition, MeetsCriteria on your FilterCondition will get called and you can decide whether the row meets the criteria or not - presumably using the same basic logic you are using to decide which image gets assigned to the appearance of the cell. I
m not 100% sure this will work, because I don't know if the filter cell will pick up the image when the user selects an item from the list that has an image on it. I think it will, but I could be wrong - in which case you might just have to make do with some descriptive text. I could probably whip up a sample for you, but it's really tough to do without knowing what kind of column this is and what the criteria for your images is. Is there a dropdown in this cell? Are you using the filter row? Are you using the UltraGridFilterUIProvider? If you could maybe post a sample that is representative of the correct data date, filtering, and images in your real grid, that would help a lot.
Hello Mike, thank you so mucho for your response.
Attached is a code example. As showed in the image the code example generates a grid with 2 could, Driver, it has a driver code in text and a Image, the what image is it displayed depends on the value for DriverImage, this second column will be hidden to the user. Now what I need to achieve is give the user the option to filter by that image but keeping the option to filter by the text too. It is not required to display the image in the filter with the other driver list values. Actually the filter could looks like this, where the images are represented by a description in text:
phase1
pase2
trainer
AZKX
XDDX
PIET
UJMD
UDJM
UltraGridExample.zip