Closed dashorty closed 1 year ago
Thanks for reporting this issue, @dashorty! I didn't even know that you can - in principle - use nested dictionaries for defining row data. But apparently we can't use column IDs with dots like in the following example:
ui.aggrid({
'columnDefs': [{'headerName': 'First name', 'field': 'name.first'}],
'rowData': [{'name.first': 'Alice'}],
})
That's because AG Grid tries to access rowData[0]['name']['first']
instead of rowData[0]['name.first']
.
I'm not sure if this is a bug in NiceGUI or rather a limitation of AG Grid. Maybe NiceGUI should warn about column IDs containing dots? What do you think, @dashorty? Do you have an idea in mind how to approach this?
I think a warning at runtime and/or a note in the documentation would be sufficient.
According to https://stackoverflow.com/questions/58772051, it's possible to show field names with dots by suppressing Aggrid's parsing for nested structures
Thanks for the hint, @firai!
So should we simply set suppressFieldDotNotation
instead of showing a warning?
So should we simply set
suppressFieldDotNotation
instead of showing a warning?
It seems to me that having dots in the field names would be much more common than trying to display nested json structures, so I would think so. But as soon as I say that, I'm sure we'll get this: https://xkcd.com/1172/
Ok, in 325dfcd I set the suppressFieldDotNotation
option instead of showing a warning. That should work in basically all cases.
I also added the possibility to pass additional options to the from_pandas
method. So the user could overwrite this flag.
Does the complex object demo that you added need to explicitly set the flag to false
then?
@firai I don't think so, because it doesn't use from_pandas
.
Description
If there is a period in the Name column, the value of this column is not displayed. I noticed when I wanted to normalize a JSON with panda.
Here is an example: