Skip to content

Commit 6fe647e

Browse files
committed
fix(slickgrid): init slick before listeners
Use explicit initialization of slick grid once dom elements are ready, but do not set listeners before initialization Closes #690
1 parent e80f273 commit 6fe647e

File tree

1 file changed

+21
-21
lines changed
  • src/modules/types/edition/slick_grid

1 file changed

+21
-21
lines changed

src/modules/types/edition/slick_grid/view.js

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,26 @@ define([
466466
that.grid.setSelectionModel(new Slick.CellSelectionModel());
467467
}
468468

469+
$(that.grid.getHeaderRow()).delegate(':input', 'change keyup', function (e) {
470+
var columnId = $(this).data('columnId');
471+
if (columnId != null) {
472+
columnFilters[columnId] = $.trim($(this).val());
473+
columnFilterFunctions[columnId] = getColumnFilterFunction(columnFilters[columnId]);
474+
that.slick.data.refresh();
475+
}
476+
});
477+
478+
that.grid.onHeaderRowCellRendered.subscribe(function (e, args) {
479+
$(args.node).empty();
480+
$("<input type='text'>")
481+
.css('width', '100%')
482+
.data('columnId', args.column.id)
483+
.val(columnFilters[args.column.id])
484+
.appendTo(args.node);
485+
});
486+
487+
that.grid.init();
488+
469489
that._activateHighlights();
470490

471491

@@ -712,26 +732,6 @@ define([
712732
that.grid.render();
713733
});
714734

715-
716-
$(that.grid.getHeaderRow()).delegate(':input', 'change keyup', function (e) {
717-
var columnId = $(this).data('columnId');
718-
if (columnId != null) {
719-
columnFilters[columnId] = $.trim($(this).val());
720-
columnFilterFunctions[columnId] = getColumnFilterFunction(columnFilters[columnId]);
721-
that.slick.data.refresh();
722-
}
723-
});
724-
725-
that.grid.onHeaderRowCellRendered.subscribe(function (e, args) {
726-
$(args.node).empty();
727-
$("<input type='text'>")
728-
.css('width', '100%')
729-
.data('columnId', args.column.id)
730-
.val(columnFilters[args.column.id])
731-
.appendTo(args.node);
732-
});
733-
734-
that.grid.init();
735735
that.slick.data.beginUpdate();
736736

737737
var groupings = _.chain(that.module.getConfiguration('groupings'))
@@ -915,7 +915,7 @@ define([
915915
}
916916
},
917917

918-
_updateHighlights: function() {
918+
_updateHighlights: function () {
919919
this._highlights = _.pluck(this.module.data, '_highlight');
920920
},
921921

0 commit comments

Comments
 (0)