The feature I'm implementing is not a really required, so I won't include an extra library of threads just for that. But if someone knows a workaround I will appreciate it.
So I have a grid of 256 rows and 3 columns; one those columns is a checkboxColumn (similar to the one used here). But that checkboxColumn plugin has being modified to show a checkbox in the header in order to allow a kind of Check-All
and Check-None
features.
Because there are so many rows, the check-all process is taking to long. So I decided to put a "Spinning wheel" (waiting gif-animation). And now the problem is that the animation doesn't work. So I put a defer
call to allow the rendering of the animated icon, but it seems like that defer
is not enough for the animation to run. Although this defer
at least allows showing the first frame of the waiting gif, instead of showing the checked-state for about a minute until the unchecked-state is show when everything is done.
Here is the expensive method:
internalSetAllColumn: function(column, newValue) {
column.masterValue = newValue;
column.header = '<div class="x-grid3-check-col-td loading-indicator"> </div>'; // loading icon
this.grid.getView().updateHeaders();
(function() {
this.grid.getStore().each(function(rec) {
if (this.isCellEditable(rec)) {
rec.set(this.dataIndex, newValue);
}
}, this);
column.renderHeaderCheck();
this.grid.getView().updateHeaders();
}).defer(50, this);
}
And you can see a working example at jsbin.com/checkallcolumn/3; and the editable code here. Click on the column checkbox (the one on the header) and see the gif that isn't spinning as expected.
Note: I have paging functionality in other places but I won't use it here as the 256 rows are always the same. So I rather lose the check all button than paging this.