DataGrid: after edit redraw all rows#69
DataGrid: after edit redraw all rows#69vitkutny wants to merge 1 commit intonextras:masterfrom vitkutny:grid-inline-edit
Conversation
After editing the row could not be in result when not ordered by ID w. If there are data in grid sorted by name and i change the name using inline edit this row can be now on different page and grid needs to redraw all rows.
|
This is probably not a good idea. When you change a field which is the grid sorted by, you probably don't want to redraw all rows and lost the row. But you probably want this - so I think you can manually invalidate all rows, can't you? |
This will be best behaviour. But does not work right now. After edit it throws exception that row is not found. I tried it and ended with following code (from It would be better if inline edit supported ajax. And this behaviour of preserving edited row in grid will work only in ajax requests. public function processForm(UI\Form $form)
{
$allowRedirect = TRUE;
if (isset($form['edit'])) {
if ($form['edit']['cancel']->isSubmittedBy() || ($form['edit']['save']->isSubmittedBy() && $form['edit']->isValid())) {
$editRowKey = $form['edit'][$this->rowPrimaryKey]->getValue();
$this->invalidateRow($editRowKey);
try {
$this->getData($editRowKey);
} catch (\Exception $e) {
if ($e->getMessage() === 'Row not found') {
$this->invalidateControl('rows');
} else {
throw $e;
}
}
$allowRedirect = FALSE;
}
if ($form['edit']['save']->isSubmittedBy()) {
if ($form['edit']->isValid()) {
Callback::invokeArgs($this->editFormCallback, array(
$form['edit']
));
} else {
$this->editRowKey = $form['edit'][$this->rowPrimaryKey]->getValue();
$allowRedirect = FALSE;
}
}
if ($this->editRowKey !== NULL) {
$this->invalidateRow($this->editRowKey);
}
}
} |
so that's the bug. |
|
Sorry, I don't understand this issue fully.
|
|
ping @vitkutny |
After editing the row could not be in result when not ordered by ID w.
If there are data in grid sorted by name and i change the name using inline edit this row can be now on different page and grid needs to redraw all rows.