Grid functionality - using display text instead of underlying values for columns

0 Answers 55 Views
Grid
Daniel
Top achievements
Rank 1
Daniel asked on 19 Jul 2022, 10:03 PM

 

Started building my first app with Blazor Grid and running into some issues.   Have several columns that need dropdownlist to display text instead of underlying number (eg select and display "Operations Department"  instead of value of 3) 

The grid will not sort based on the Display Text but does so instead based on value.    Same when trying to group using the field.  Sort by the value in groups (and I see no way to change the sort order from ascending to descending on the groups too).

 

 

Nadezhda Tacheva
Telerik team
commented on 22 Jul 2022, 02:22 PM

Hi Daniel,

I suppose you are referring to a dropdownlist that will be visible in the edit mode of the corresponding column or when filtering it. Is that correct?

The most suitable approach to proceed with will depend on the data you are using. For example, if you are using Enum, the Grid will by default display the named constants of the underlying numeric values. In this case, the Grid will also render DropDownList for editing and filtering Enums. The sorting will be performed based on the Enum numeric values. Take a look at the Filter and Edit Enum in Grid article.

If you are binding the Grid to a complex model, you will need to use the corresponding templates to control how the Grid renders the data in display mode or when the user edits or filters (see Grid Templates).

In terms of sorting - I'd like to confirm your desired behavior to make sure we are on the same page. Can you please confirm if you are trying to achieve sorting by the value or the displayed text?

As for sorting the grouped column, this functionality is not yet available, but it will be supported in future version of the product. You can vote for it and follow it here:

Allow sorting the grouped column

If you are facing any difficulties after revising the linked resources, please let me know. In this case, please share a runnable replication of the problematic scenario. Thus I can test your exact configuration on my end, advise what is missing and suggest an option to proceed. You can generate some dummy data just for testing purposes, I just need to know the type of data you are binding the Grid to and the exact way you are displaying it.

Thank you in advance!

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Daniel
Top achievements
Rank 1
Share this question
or