Closed lieszkol closed 7 years ago
For UPDATE: Only name of the filter/sort can be changed and saved. For CREATE: The name of the filter/sort with entire detailed settings would be saved.
Therefore, if you need to actually edit the filter's or sort's detailed settings then the steps to follow is:
This seems counter intuitive from a user perspective. The help text on the popup dialog says: "Set a name to save the state of your current grid sort. You can alternatively select a saved sort from the list below to edit or delete." For me this means that I can edit an existing, saved setting. Ideally, whether the user is able to change existing filters should be a dynagrid setting. Otherwise it would be useful to make note of the above logic in the docs and the popup description should be changed to something along the lines of: "Set a name to save the state of your current grid sort. You can alternatively select a saved sort from the list below to edit the name or to delete."
I thought something was wrong on my end (why aren't the changes being saved!!!) which is why I spent time debugging it and creating this ticket for you :-) As a side-note, this feature would be way more useful if there would be a way to load a saved filter/sort other than setting it as a default in the grid config dialog. I.e. if there was a "Load" button on the filter/sort popup dialogs.
In any case thank you for all the work you've put into these widgets.
P.s. this is a bit inconsistent, since if the widget store is not db then filter/sort settings can in fact be updated, i.e. with the online dynagrid demo it IS possible to save changes to an existing filter/sort.
There is been some thought put into this on why this is such. Note that you need to consider all use cases of how users will be operating
red books
, and books > 100
red books
to dark colored books
he can just select red books
and rename it... he does not need to worry if he has another filter criteria applied on his grid that will overwrite the filter logic settings.red books > 100
, then he just selects this new criteria and creates a filter with name red books > 100
(or applies one of the presaved filters and does the changes). Then if he does not need red books
he can delete red books
.Go through all use cases and if you have suggestions for improvement - you are free to submit a PR. Also consider the facts that this must not break the extension or usage if user has selected and applied filters inadvertently and tried to edit the filter name only.
this is a bit inconsistent, since if the widget store is not db then filter/sort settings can in fact be updated, i.e. with the online dynagrid demo it IS possible to save changes to an existing filter/sort.
Will need to check this and if it is not consistent will record an enhancement.
I would be happy to implement any changes if that would be helpful, but I wouldn't want to make any decisions regarding the workings of the widget.
A new property dbUpdateOnlyName
is been added to DynaGrid
. This defaults to false
and is applicable only when storage is set to db
. Saving the settings when this is false
will save/update/overwrite both the filter
/ sort
name and its settings. Setting this to true
will only save the name on edits.
The hint text will be updated with better explanation of this setting.
For non database storage (session
or cookie
it will always save the name and also overwrite the settings).
Thank you for the support, works great!
When 'storage'=>'db' and user tries to edit existing sort/filter settings, the changes are simply not saved to the db. This is because of line 386 in DynaGridStore.php, function store():
$data = ($out != null) ? [$nameAttr => $this->name] : [
This should be changed to this so that if the key exists then it is updated:$data = ($out != null) ? [$nameAttr => $this->name, $dataAttr => $configData] : [