Sort unigrid columns on ExternalSourceName field instead of Source field

Hendrik Clercx asked on October 1, 2020 16:40

Hello

For one of our customers, I had to expend the existing Order overview application with some extra columns. These columns use the ExternalSourceName field for the transformations to display a field coming from an other table with the OrderID as foreign key. See picture below:

Order overview with extra columns

The problem is that the sorting doesn't work properly for these custom columns. The Source value is set to OrderID and via a transformation I retrieve the correct value based on this OrderID. However, the sorting mechanism seems to use the Source field as the value to sort on.

Is there a way to tell the sorting mechanism to sort on the actual text displayed of the transformation instead of the Source value, OrderID in this case.

So for each of these columns, it uses the OrderID to sort the rows instead of 'Yes', Store 123', etc.

Current code I use:

Code to display custom field

Correct Answer

Brenden Kehren answered on October 1, 2020 20:03

Your best bet is to "transform" that data in a custom query prior to connecting the datasource to the grid. If you don't you'll have to create a custom sorting event for that field which will require you to clone that unigrid control and create your own custom one.

0 votesVote for this answer Unmark Correct answer

Recent Answers


Hendrik Clercx answered on October 2, 2020 16:22

Thanks for the answer Brenden.

A custom Query was indeed the solution to my problem. In this query I could join with an other table and then in the Columns property of the unigrid I could specify the other columns from this other table. This way I could specify the new column as the Source of the ug:Column tag.

Some more info about the Query: documentation

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.