contributte / datagrid

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

Inline editing doesn't work for primary keys which include spaces #670

Open janmottl opened 6 years ago

janmottl commented 6 years ago

Inline editing doesn't work for primary keys which include spaces. In line editing is not displayed.

I have a primary key "OP žadatele o ÚL". It resulted into a snippet "snippet-acomplDatagrid-item-OP žadatele o ÚL" which was not processed successfully. I have to to create redundant alternative key.

dakorpar commented 6 years ago

First flaw I see here is that you should not really have such a primary key. IMHO your best solution for this is to add autoincrement id field in table as pk and set thisyour current pk field as unique if you need it unique. You could make up some virtual private key for table but this will allways cause issue since it's going to be hard to connect it with real row and you need to make sure it won't happen that two are same. I don't really see that datagrid should support this...

janmottl commented 6 years ago

Hi, thanks for your opinion. It's clear that alternative generated key solves described Datagrid problem and its limitations. I have described this workaround already in last sentence my first post.

There are only two requirements on primary key from data modeling point of view. It must be NOT NULL and UNIQUE. From data modeling point of view:

I recommend to extend documentation and describe Datagrid data model limitations:

Its reccomended to have a numeric unique key containing one column. Add generated numeric alternative key if you have: