这是我第一次使用Slickgrid,我在我的组织中配置了slickgrid treeview example5。不幸的是,不能使崩溃的工作。调试后我注意到的一件事是onRowCountChanged事件没有被调用。
任何人都可以帮助我。提前谢谢......
我在页面上将事件连接为 -
$(function () {
Visualforce.remoting.Manager.invokeAction(
'{!$RemoteAction.QuoteHandler_c.getQuoteItems}','{!quote.id}',
function(result, event) {
quoteItems = result;
prepateData();
// initialize the model
dataView = new Slick.Data.DataView({ inlineFilters: true });
dataView.beginUpdate();
dataView.setItems(data);
dataView.setFilter(myFilter);
dataView.endUpdate();
// initialize the grid
grid = new Slick.Grid("#myGrid", dataView, columns, options);
grid.onClick.subscribe(function (e, args) {
if ($(e.target).hasClass("toggle")) {
var item = dataView.getItem(args.row);
if (item) {
if (!item._collapsed) {
item._collapsed = true;
} else {
item._collapsed = false;
}
dataView.updateItem(item.id, item);
}
e.stopImmediatePropagation();
}
});
// wire up model events to drive the grid
dataView.onRowCountChanged.subscribe(function (e, args) {
grid.updateRowCount();
grid.render();
});
dataView.onRowsChanged.subscribe(function (e, args) {
grid.invalidateRows(args.rows);
grid.render();
});
var h_runfilters = null;
// wire up the slider to apply the filter to the model
$("#pcSlider").slider({
"range": "min",
"slide": function (event, ui) {
Slick.GlobalEditorLock.cancelCurrentEdit();
if (percentCompleteThreshold != ui.value) {
window.clearTimeout(h_runfilters);
h_runfilters = window.setTimeout(dataView.refresh, 10);
percentCompleteThreshold = ui.value;
}
}
});
// wire up the search textbox to apply the filter to the model
$("#txtSearch").keyup(function (e) {
Slick.GlobalEditorLock.cancelCurrentEdit();
// clear on Esc
if (e.which == 27) {
this.value = "";
}
searchString = this.value;
dataView.refresh();
})
}
);
})
答案 0 :(得分:1)
感谢您的帮助......
我明白了。错误在于myFilter函数。因此,总行返回的行数相同因此onRowsCountChanged未被调用。