TrueDBGrid filtering DropDown values

Posted by: dirk.kuehnle on 25 June 2021, 1:32 am EST

  • Posted 25 June 2021, 1:32 am EST

    Hello,

    I’m using TrueDBGrid with DropDown columns and Filter.

    The values in the DropDown list have following structure (KeyValuePair):

    long ID
    string text
    
    

    In the Grid-column, the underlying ID is transformed and the text is shown.

    If I try to filter this column by entering the text in the filterrow, filter doesn’t work correctly. Only filtering by ID is working.

    Can you please show me, how to Filter the column by text?

    Thanks and best regards,

    Dirk

  • Posted 28 June 2021, 4:26 am EST

    Hi,

    The filtering in TrueDbgrid is done on the data column, so when you use the dropdown in a column with TranslateValue, the column still has the values and not the text. In the filter bar to filter the translated values, you can either type the value or the full-text corresponding to a value. It is directly possible to filter by partial text in this case. We would suggest you set the FilterDropDown property of the column that has the dropdown so that you can filter by using a drop-down that shows the display values.

    Please refer to the sample attached.

    Regards.

    Avnish

    TrueDbgridDropdown.zip

  • Posted 28 June 2021, 7:55 am EST

    Hi Avnish,

    thank you for your answer but this solved not my problem.

    The problem I have is not the DropDown in filterrow as in your example.

    My problem is a C1TrueDBDropDown within the table column. The entries have IDs and the DropDown translates the IDs into text, e.g. the ID for “Saphira” in attached image is 5, but Saphira is shown (1 in Image).

    When I now try to filter for “Saphira” in the filtercolumn (2 in Image), the filter shows no result. If I filter for 5, the grid shows all Rows with Brand “Saphira”.

    What I need, is to filter for “Saphira” and get all rows with Brand Saphira.

    Thanks and regards,

    Dirk

  • Posted 29 June 2021, 3:33 am EST

    Hi Dirk,

    As we mentioned before, if we write full text like “Saphira” at our end, the FilterBar filters the grid. Please refer to the GIF attached showing the same.

    If you want to filter by writing partial texts like “Sa” for Saphira then as a workaround to achieve this behavior. You can add an extra column in the data table which will have the text saved as the value and then use this column to apply filter. You can just hide this column and then use the FilterChange event to copy the filter text from the column that contains DropDown to this column. Please refer to the sample attached and modify it according to your requirements.

    Regards.

    Avnish

    UsingC1TDBDropdown_mod.zip[img]https://gccontent.blob.core.windows.net/forum-uploads/file-4a4f58f8-7f00-40e4-8337-dc8af9aa5ba3.gif[/img]

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels