我一直在挖掘這個相當多的。我使用的是dojox.grid.datagrid,並且我有一個可以返回200-300行的ajax調用。Dojo DataGrid虛擬滾動方法?
Chrome瀏覽器中的網格渲染和滾動情況良好,但在IE 7和8中滾動的速度極慢。我想使用虛擬滾動來嘗試修復問題,但找不到任何示例代碼。
這是我的代碼目前的樣子。
function setupAvailableScenes(location) {
var avaiableScenesGridPane = dijit.byId("AvaiableScenesGridPane");
var availableScenesGrid = dijit.byId("AvailableScenesGrid");
if (_isFirstLoad) {
availableScenesGrid = new dojox.grid.DataGrid({
id: 'AvailableScenesGrid',
store: availableScenesStore,
query: { Id: "*" },
sortInfo: "1",
rowsPerPage: 20,
autoHeight:20,
style: "width:315px",
structure: [
{ name: "Available Scenes", field: "Name", width: "85%" },
{ name: " ",
field: "_item",
rowsPerPage: "25",
type: dojox.grid.cells._Widget,
editable: false,
width: "15%",
formatter: function (scene) {
return new dijit.form.Button(
{
label: "+",
onClick: function() {
AddSceneToSelectedScenes(scene);
}
})
}
}
]
});
avaiableScenesGridPane.set('content', availableScenesGrid);
}
var availableScenesStore = new dojo.data.ItemFileWriteStore({
url: _applicationPath + "/Location/" + location.Id + "/Scene.json",
preventUrlCache: true
});
availableScenesGrid.setStore(availableScenesStore);
}
感謝您的關注。我知道它應該做虛擬滾動,但我沒有看到頭部中發送的參數。 我假設startrow和要返回的行數是參數,我將不得不發送到我的控制器,然後在我的數據層中處理以返回行數。 我會看看如果一個簡單的按鈕將在dijit中執行。讓我知道你對虛擬滾動的看法。 – Ali 2012-03-13 16:16:11
恩 - 請你澄清一下嗎?你期望哪些標題被髮送?你指的是延遲加載還是虛擬滾動? – 2012-03-13 16:17:52
虛擬滾動。基本上,我希望網格一次加載25-50行。 – Ali 2012-03-13 16:26:32