Skip to content

Commit bb9ab3b

Browse files
committed
Merge branch 'fix/grid-column-picker' into 'master'
Fix grid column picker. See merge request datopian/clients/nhs-dataexplorer!13
2 parents 95c4eac + 4475224 commit bb9ab3b

File tree

1 file changed

+8
-5
lines changed
  • ckanext/dataexplorer/public/vendor/recline

1 file changed

+8
-5
lines changed

ckanext/dataexplorer/public/vendor/recline/recline.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3293,13 +3293,15 @@ my.SlickGrid = Backbone.View.extend({
32933293

32943294
// Move hidden columns to the end, so they appear at the bottom of the
32953295
// column picker
3296+
/*
32963297
var tempHiddenColumns = [];
32973298
for (var i = columns.length -1; i >= 0; i--){
32983299
if (_.indexOf(_.pluck(visibleColumns,'id'),columns[i].id) === -1){
32993300
tempHiddenColumns.push(columns.splice(i,1)[0]);
33003301
}
33013302
}
33023303
columns = columns.concat(tempHiddenColumns);
3304+
*/
33033305

33043306
// Transform a model object into a row
33053307
function toRow(m) {
@@ -3578,13 +3580,13 @@ my.GridControl= Backbone.View.extend({
35783580

35793581
if (grid.getColumnIndex(columns[i].id) !== null) {
35803582

3581-
$input.attr('checked', false);
3582-
3583+
var check = false;
35833584
for (var j = 0; j < current_columns.length; j++) {
35843585
if (current_columns[j].id == columns[i].id){
3585-
$input.attr('checked', 'checked');
3586+
check = true;
35863587
}
35873588
}
3589+
$input.attr('checked', check);
35883590
}
35893591
$input.appendTo($li);
35903592
$('<label />')
@@ -3653,12 +3655,13 @@ my.GridControl= Backbone.View.extend({
36533655
return;
36543656
}
36553657

3656-
grid.setColumns(visibleColumns);
3657-
36583658
var fields = []
36593659
for (var i = 0; i < visibleColumns.length; i++){
36603660
fields.push(visibleColumns[i].id)
36613661
}
3662+
3663+
grid.setColumns(visibleColumns);
3664+
36623665
model.queryState.attributes.fields = fields;
36633666
options.state.set({hiddenColumns:hiddenColumnsIds});
36643667
}

0 commit comments

Comments
 (0)