2011-08-17 46 views
5

我有分頁的網格。每頁最多有10行。像這樣: enter image description here如何將空行添加到ExtJS網格?

我在CSS中爲.x-grid3-scroller選擇器設置了漸變背景。一切都很好,而DirectStore中有10個項目。但是,如果項目數量少於10我有這個問題: enter image description here

如果爲.x-grid3-scroller設置條紋背景,那麼在列中將沒有邊框。

如何將空行添加到網格以使網格適合底部?

回答

5

存儲加載後(使用load監聽器)檢查有多少記錄(getCount()方法)並添加(add()方法)10 - store.getCount()空記錄。

store.on('load', function(store) { 
    var records = new Array(); 
    for(var i = 10 - store.getCount(); i > 0; i--) { 
    records.push(new store.recordType(/*you might need to provide default data here*/)) 
    } 
    store.add(records); 
}); 
+0

謝謝!我不知道爲什麼,但我認爲如果我將一個空記錄添加到商店這將打破尋呼機。但一切都很好。再次感謝你! – BUDDAx2 2011-08-17 12:58:55