I've got a grid that is declaratively bound:
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
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
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.
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 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(...)
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.