datagrid
datagrid copied to clipboard
inLineEdit - onSubmit function delivers empty values of hidden colums
inLineEdit - onSubmit function delivers empty values of hidden colums. That's very insidious and dangerous because it causes destroying of data in invisible columns.
I have following workaround: ` $this->hiddenColumns = $grid->getSessionData('_grid_hidden_columns');
$grid->getInlineEdit()->onSubmit[] = function($id, $values) {
$notHiddenValues = [];
foreach ($values as $key => $value) {
// zjistit je column hidden a vynechat ho
if (empty($this->hiddenColumns) || (!in_array($key, $this->hiddenColumns, true))) {
$notHiddenValues[$key] = $value;
}
}
if ($this->db->table('cenik')->where('cenik_kod=?', $id)->update($notHiddenValues) !== false) {
$this->logManager->recordTableUpdate('cenik', $notHiddenValues, $notHiddenValues,
'cenik_kod', $id);
$this->flashMessage('Ceníková položka byla uložena', self::MSG_SUCCESS);
} else {
$this->flashMessage('Chyba při uložení ceníkové položky', self::MSG_ERROR);
}
$this->redrawControl('headerSnippet');
};
`
@janmottl Would do you propose?
My proposal is to add a new parameter to onSubmit function. Additional parameter would create no troubles for existing applications. /* $visibleColumnValues - values of visible columns $hiddenColumns - names of hidden columns */ $grid->getInlineEdit()->onSubmit[] = function($id, $visibleColumnValues, $hiddenColumns) { }
Could you please send a PR into branch v6.x? Thanks a lot. I like your suggestion
yes. I hope I have done what you have expected.
Any progress on this one? We just lost some data because of this...