contributte / contributte/datagrid
inLineEdit - onSubmit function delivers empty values of hidden colums
Open
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 296
- Forks
- 215
- PR merge metrics
- No merged PRs in 30d
Description
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');
};
`
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the inline-edit onSubmit entry point mentioned in the issue and reproduce an edit while one or more columns are hidden. Trace which values are submitted and persisted, then verify that hidden columns are not replaced with empty values while visible edits still save correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100