contributte / datagrid

:muscle: DataGrid for Nette Framework: filtering, sorting, pagination, tree view, table view, translator, etc
https://contributte.org/packages/contributte/datagrid/
MIT License
288 stars 193 forks source link

UUID support in addAction (signal) #735

Closed Rixafy closed 5 years ago

Rixafy commented 5 years ago

Hi, recently I tried make Edit button in datagrid, datagrid is in component which is attached to presenter. I created handleEdit($id) in component for handling signal, but when I use link 'edit!' and parameters ['id' =>'id'], 'id' patameter does not appear in the link. I suppose the problem is that $item['id'] is Uuid object, not string or integer, so you need to cast it to string by calling toString().

This is my workaround

image

image

Suggested solution: https://github.com/contributte/datagrid/blob/v5.x/src/Row.php#L90 is_array($this->item) is true, because I have array result of selected fields, but in my array result, $item['id'] is Uuid entity, https://snipcode.link/7Mv for instance

paveljanda commented 5 years ago

@rixafy You can send a PR with uuid support. :) (Most people use ramsey/uuid?)

JakubKontra commented 5 years ago

@paveljanda ramsey/uuid +1

Rixafy commented 5 years ago

@JakubKontra, what isn't supported exept this (it works well, but only when the href and parameters aren't used in action, and it's handled by router and action)? Maybe I can look at it, but I'm using this datagrid with UUIDs maybe month and I had only this issue.

Rixafy commented 5 years ago

Fixed in https://github.com/contributte/datagrid/pull/736