Skip to content

Instantly share code, notes, and snippets.

@lsmith
Last active December 17, 2015 02:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lsmith/5536394 to your computer and use it in GitHub Desktop.
Save lsmith/5536394 to your computer and use it in GitHub Desktop.
_toggleStripes: function (index) {
var task = this._toggleStripesTask,
self;
// index|0 to force int, avoid NaN. Math.max() to avoid neg indexes.
index = Math.max((index|0), 0);
if (!task) {
self = this;
this._toggleStripesTask = {
timer: setTimeout(function () {
var odd = [this.CLASS_ODD, this.CLASS_EVEN],
even = [this.CLASS_EVEN, this.CLASS_ODD];
self.tbodyNode.get('childNodes')
.slice(self._toggleStripeTask.index)
.each(function (row, i) {
row.replaceClass.apply(row, (index + i) % 2 ? odd : even);
});
this._toggleStripesTask = null;
}, 0),
index: index
}
} else {
task.index = Math.min(task.index, index);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment