This is a migrated thread and some comments may be shown as answers.

How does one adjust the display value for grouping?

0 Answers 88 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chad
Top achievements
Rank 1
Chad asked on 01 May 2012, 03:26 PM
I've got a grid that is declaratively bound:
data-role="grid" data-bind="source = logEntries"

One of the columns is a Log Level column.  The data source field (Level) is an integer. I have that column declared with the template 
"template": "#= viewModel.getLogLevelAsName(Level) #"
that converts the integer into a human-friendly display name.  A human doesn't know the difference between log level "2" and log level "5" but certainly knows the difference between log level "Debug" and log level "Error."  This works out great because when the user sorts, they are sorting on the relative underlying value (the log level number) and not the display text.

That said, when I group by that column, the underlying data (log level number) shows to the user (see attached screenshot).  I'd like to run that number through the same
viewModel.getLogLevelAsName(...)
method.

Or maybe I'm missing something?  For example, some baked-in way to provide a lookup (display) value for items in a grid (besides using a manually-written template)?  Something like the ability to assign a column a "lookup data source" (data-display pair) so that the underlying data is always shown to the user based on the results of the lookup.

No answers yet. Maybe you can help?

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