fix: keep original value along with rendered, in grid vue context
this change was made for sake of sorting, when the backend is not responsible for that. in particular datetime values must be "rendered" somehow when passing to frontend, but depending on various factors the rendering may not preserve the "sensible" sort order behavior, e.g. if "weekday name" begins the rendered string. so in all cases now, rendered values will be given a distinct key in the record dict, while the original value stays in its original place. this should let grid sorting work off the original value, and hopefully all is well..fingers crossed
This commit is contained in:
parent
d08ba5fe51
commit
16131cd256
3 changed files with 23 additions and 12 deletions
|
|
@ -2025,7 +2025,12 @@ class TestGrid(WebTestCase):
|
|||
context,
|
||||
{
|
||||
"data": [
|
||||
{"foo": "blah blah", "baz": "zoo", "_action_url_view": "/blarg"}
|
||||
{
|
||||
"foo": "bar",
|
||||
"_rendered_foo": "blah blah",
|
||||
"baz": "zoo",
|
||||
"_action_url_view": "/blarg",
|
||||
}
|
||||
],
|
||||
"row_classes": {},
|
||||
},
|
||||
|
|
@ -2080,7 +2085,16 @@ class TestGrid(WebTestCase):
|
|||
# can override value rendering
|
||||
grid.set_renderer("foo", lambda record, key, value: "blah blah")
|
||||
data = grid.get_vue_data()
|
||||
self.assertEqual(data, [{"foo": "blah blah", "_action_url_view": "/blarg"}])
|
||||
self.assertEqual(
|
||||
data,
|
||||
[
|
||||
{
|
||||
"foo": "bar",
|
||||
"_rendered_foo": "blah blah",
|
||||
"_action_url_view": "/blarg",
|
||||
}
|
||||
],
|
||||
)
|
||||
|
||||
def test_get_row_class(self):
|
||||
model = self.app.model
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue