contributte / datagrid

:muscle: DataGrid for Nette Framework: filtering, sorting, pagination, tree view, table view, translator, etc

Home Page:https://contributte.org/packages/contributte/datagrid/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`ColumnStatus` not working for some reason

matronator opened this issue · comments

I have a grid where I need to show two status columns. One is from a varchar/string column (this one works) and the other one is from a bool/tinyint column with numeric index keys and the second one for some reason just won't work. When looking at the generated HTML, it seems to have everything EXCEPT for the button to toggle the dropdown.

This is the code:

$grid->addColumnStatus('enabled', 'Status')
->setCaret(true)
->addOption(1, 'Enabled')
	->setIcon('check')
	->setClass('btn-success')
	->endOption()
->addOption(0, 'Disabled')
	->setIcon('close')
	->setClass('btn-danger')
	->endOption()
->onChange[] = [$this, 'setStatus'];

$grid->addColumnStatus('value', 'Value')
->setOptions(array_map(function($item) {
	return ucfirst($item);
}, MY_CLASS::VALUES))
->onChange[] = [$this, 'setValue'];

And this is the result:

Snímek obrazovky 2022-09-16 v 17 59 08

I tried setting the options with an array instead like in the second one, but it didn't change anything. Why is it not working? Is it maybe the numeric index keys that are causing it?