nextras / datagrid

Nextras Datagrid component for Nette Framework.
http://nextras.org/datagrid
MIT License
70 stars 39 forks source link

Inline edit reduces the dataset to one row #63

Closed maral closed 7 years ago

maral commented 8 years ago

Hi guys, first of all, thanks for this project, it's awesome and we use it often at Vcelka.cz ;)

Now, I think in previous versions the datagrid used to behave differently in regard to editting. When I used edit, all rows remained, but the edited was changed to inputs. Then after cancelling, the whole datagrid remained the same. However, with this version (e.g. here) when I select edit, all the other rows disappear, and remain gone even when I cancel the action, which I think is a bug. If not, then what was the idea behind that?

I would love to help fixing this, but I am not very good with ajax and partial snippet redrawing..

hrach commented 8 years ago

What does "this version" exactly mean?

hrach commented 8 years ago

Oh, you mean the demo? I believe the master should be ok...

maral commented 8 years ago

Okay, I'll try to upgrade. I wasn't sure if I'm doing something wrong, so I just checked the demo and saw the same problem, so I assumed it's how the things are. I might be good idea to update the demo's version.

hrach commented 8 years ago

Yeah, probably, I'm going to remove demos from offcial site and distribute them with the source-code. Btw, try the master.

maral commented 8 years ago

Okay, so I tried upgrading to master - with the same result, unfortunately. Whenever I do basic editing with the minimal setting via ajax, all other rows just disappear. I have tried changing almost everything and it still works odd like this. I am starting to believe it's a feature 😄.

I also found couple more things - at @bootstrap3.datagrid.latte, in block #col-filter there is missing class "form-control" - it used to be there, no idea why it's gone (and the filter inputs look ugly without it).

Another thing I noticed - if you don't add filter form factory, the actions column is not rendered, even when it is defined in a template that is added by the method addCellsTemplate. The cause of the problem is, that the test for this column in Datagrid.latte checks existence of $this->blocks['row-actions'], which is not defined. But as I found out, the block exists in $this->blockQueue['row-actions'] and can be used via macros. Now, I really don't understand the internals of Latte system, so I have no idea how these two arrays relate. My guess is, that the {import} macro does not put new blocks to $this->blocks, just to $this->blockQueue, because all blocks defined in Datagrid.latte are present in $this->blocks - only imported blocks are missing.

hrach commented 7 years ago

@maral

hrach commented 7 years ago

For now I would close this as cannot reproduce, feel free to reopen a provide more feedback :-) Thanks!