Skip to content

Commit

Permalink
Merge branch 'columns-persistance' into 'master'
Browse files Browse the repository at this point in the history
Columns persistance

See merge request mistio/mist-list!27
  • Loading branch information
d-mo committed Sep 19, 2018
2 parents c28b16e + 696d9be commit 2f16e2a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mist-list",
"version": "1.5.1",
"version": "1.5.2",
"authors": [
"Dimitris Moraitis <[email protected]>",
"Christina Papakonstantinou <[email protected]>"
Expand Down
14 changes: 12 additions & 2 deletions mist-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ <h2>Download list data in CSV</h2>
'selectedItemsChanged(selectedItems.length)',
'toggleSelectAll(selectAll)',
'setShowNoData(items, filteredItems.length)',
'_visibleChanged(visible)',
'_visibleChanged(visible)'
],

listeners: {
Expand Down Expand Up @@ -734,6 +734,7 @@ <h2>Download list data in CSV</h2>

if (JSON.parse(localStorage.getItem('mist-list#' + this.id))) {
this.set('visible', JSON.parse(localStorage.getItem('mist-list#' + this.id)));
// console.log('get localStorage', this.visible);
var sorters = JSON.parse(localStorage.getItem('mist-list#' + this.id + '/sorters'));
if (sorters && sorters.length)
this.set('sorters', sorters);
Expand Down Expand Up @@ -927,8 +928,16 @@ <h2>Download list data in CSV</h2>
this.colmap[keys[k]] = true;
}
}
// Compute columns list from colmap, removing frozen columns
var cols = Object.keys(this.colmap);
// Add the visible columns if any that are not an item property
if (this.visible && this.visible.length) {
for (var j = 0; j < this.visible.length; j++) {
if (cols.indexOf(this.visible[j]) == -1) {
cols.push(this.visible[j]);
}
}
}
// Compute columns list from colmap, removing frozen columns
this.frozen.forEach(function (f) {
if (cols.indexOf(f) > -1)
cols.splice(cols.indexOf(f), 1);
Expand Down Expand Up @@ -1223,6 +1232,7 @@ <h2>Download list data in CSV</h2>
},

_visibleChanged: function (visible) {
// console.log('visible changed', this.visible);
this.set('CSVvisible', this.CSVvisible || visible);
},

Expand Down

0 comments on commit 2f16e2a

Please sign in to comment.