mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 01:32:38 +00:00
Save DataTable states server side
This commit is contained in:
parent
6866109b97
commit
dd8fa5ff66
@ -110,6 +110,7 @@ _- (Because the stock quantity unit is now the base for everything, it cannot be
|
||||
- Table columns can now be shown/hidden (new little eye icon on the top left corner on each table)
|
||||
- There are also new columns on some pages, hidden by default
|
||||
- Stock overview: Value, product group, calories
|
||||
- Table states (visible columns, sorting, column order and so on) are now saved server side (in user settings) means that this stays the same when using different browsers
|
||||
- Dialogs are now used everywhere where appropriate instead of jumping between pages (for exampel when adding/editing shopping list items)
|
||||
- Added a "Clear filter"-button on all pages (with filters) to quickly reset applied filters
|
||||
- The data path (previously fixed to the `data` folder) is now configurable, making it possible to run multiple grocy instances from the same directory (with different `config.php` files / different database, etc.) (thanks @fgrsnau)
|
||||
|
@ -698,13 +698,32 @@ $.extend(true, $.fn.dataTable.defaults, {
|
||||
},
|
||||
'stateSaveCallback': function(settings, data)
|
||||
{
|
||||
// TODO: Save/load this server side
|
||||
localStorage.setItem('datatables_state_' + settings.sTableId, JSON.stringify(data));
|
||||
var settingKey = 'datatables_state_' + settings.sTableId;
|
||||
var stateData = JSON.stringify(data);
|
||||
|
||||
Grocy.UserSettings[settingKey] = stateData;
|
||||
|
||||
jsonData = {};
|
||||
jsonData.value = stateData;
|
||||
Grocy.Api.Put('user/settings/' + settingKey, jsonData,
|
||||
function(result)
|
||||
{
|
||||
// Nothing to do...
|
||||
},
|
||||
function(xhr)
|
||||
{
|
||||
if (!xhr.statusText.isEmpty())
|
||||
{
|
||||
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
'stateLoadCallback': function(settings, data)
|
||||
{
|
||||
// TODO: Save/load this server side
|
||||
return JSON.parse(localStorage.getItem('datatables_state_' + settings.sTableId));
|
||||
var settingKey = 'datatables_state_' + settings.sTableId;
|
||||
|
||||
return JSON.parse(Grocy.UserSettings[settingKey]);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -503,7 +503,7 @@
|
||||
<h5 id="qu-conversion-headline-info"
|
||||
class="text-muted font-italic"></h5>
|
||||
|
||||
<table id="qu-conversions-table"
|
||||
<table id="qu-conversions-table-products"
|
||||
class="table table-sm table-striped nowrap w-100">
|
||||
<thead>
|
||||
<tr>
|
||||
|
Loading…
x
Reference in New Issue
Block a user