2011-08-17 51 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