Skip to content

Instantly share code, notes, and snippets.

@kuon
Created February 22, 2011 15:23
Show Gist options
  • Save kuon/838826 to your computer and use it in GitHub Desktop.
Save kuon/838826 to your computer and use it in GitHub Desktop.
slickgrid with sproutcore
SGUI.TableView = SC.CollectionView.extend({
columns:[],
options:{},
reloadIfNeeded:function() {
var options = this.get('options');
var content = this.get('content');
var columns = this.get('columns');
function getItem(index) {
var scobject = content.objectAt(index);
var flatobject = {};
columns.forEach(function(col) {
flatobject[col.field] = scobject.get(col.field);
});
return flatobject;
}
function getLength() {
return content.get('length');
}
var data = {getLength: getLength, getItem: getItem};
if(!this._grid) {
this._grid = new Slick.Grid(this.$(), data, columns, options);
}
else {
this._grid.setData(data);
this._grid.render();
}
}
});
@dhanyaa
Copy link

dhanyaa commented Jun 26, 2014

Hi, I have created the wrapper class as above . but i am getting a error telling "SlickGrid requires a valid container, <$:sc1367>() does not exist in the DOM." Can anyone guide me through this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment