Open eri-blan opened 3 months ago
Hi @eri-blan. The clear description you provide got me thinking and I think the solution could be as simple as adding rows 631-633, as in the screenshot below:
...(c.localType === "date" && {
valueGetter: (value) => value && new Date(value),
}),
Unfortunately I don't have the time right now to fire it up and test. But I'm giving away it for free – with no guarantees. 😉
Describe the bug When activating the setting to enable the attribute table, the Hajk client crashes (becomes completely white) when clicking on the attribute table button if the layer contains a dateTime/date field, for instance Date in Oracle or timestamp in PostgreSQL.
The dateTime/date field seems to look something like this in the response from QGIS Server:
(GetFeature)
"DATUM": "2022-04-28T00:00:00.000"
(DescribeFeatureType)
I have tried altering the settings below for the layer in QGIS, but to no effect on the attribute table working or not. MUI seems to only accept Date() objects after all. Perhaps valueGetter can be used to convert the dateTime/date strings somehow? Link to MUI docs
To Reproduce Activate the functionality in Admin for a layer containing any number of dateTime fields. Click on the attribute table icon.
The following type of error will display:
ERROR MUI:
datecolumn type only accepts
Dateobjects as values. Use
valueGetterto transform the value into a
Dateobject. Row ID: 0, field: "DATUM". Error: MUI:
datecolumn type only accepts
Dateobjects as values. Use
valueGetterto transform the value into a
Dateobject. Row ID: 0, field: "DATUM". at throwIfNotDateObject (http://localhost:3000/static/js/bundle.js:67040:11) at Object.gridDateFormatter [as valueFormatter] (http://localhost:3000/static/js/bundle.js:67052:3) at Object.getCellParams (http://localhost:3000/static/js/bundle.js:87296:38) at http://localhost:3000/static/js/bundle.js:70224:41 at applySelector (http://localhost:3000/static/js/bundle.js:90112:10) at useGridSelector (http://localhost:3000/static/js/bundle.js:90132:20) at http://localhost:3000/static/js/bundle.js:70219:107 at renderWithHooks (http://localhost:3000/static/js/bundle.js:151795:22) at updateForwardRef (http://localhost:3000/static/js/bundle.js:154364:24) at beginWork (http://localhost:3000/static/js/bundle.js:156411:20)
Expected behavior The attribute table shows up as expected.
Additional context Tested using Oracle and PostgreSQL. Using QGIS/QGIS Server 3.34. I have not tested it with for instance Geoserver. Hajk version 3.14 RC1.