datagrid icon indicating copy to clipboard operation
datagrid copied to clipboard

ItemDetail doesnt work when datasource is array

Open BigOHenry opened this issue 6 years ago • 1 comments
trafficstars

Hello, ItemDetail (Eye icon) doesnt work if the datasource is array. It will not return snippent for refresh:

JSON |  
_datagrid_toggle_detail | 1
_datagrid_name | overviewDatagrid-overviewDatagrid
state | {…}
overviewDatagrid-overviewDatagrid-page | 3
overviewDatagrid-overviewDatagrid-sort | null
overviewDatagrid-overviewDatagrid-filter | null

BigOHenry avatar Aug 12 '19 07:08 BigOHenry

Ran into the same problem

my datasource is result of Nette\Database\Context ->fetchAll()

[
	0 => (Nette\Database\Row)
		id => 1
		column1 => "XXX"
		column2 => 654.0
		column3 => "2020-01-01"
]

Problem is in finding the row, for which itemDetail should be displayed

'id' in $condition is string (makes sense, is from http request), but 'id' in Row is automatically converted to int, so the strict comparsion here fails

https://github.com/contributte/datagrid/blob/v6.2.9/src/DataSource/ArrayDataSource.php#L94

Row is not found, therefore nothing is redrawed

vodictomas avatar Feb 19 '20 11:02 vodictomas