怎么判断extjs 中gridpanel中是否存在数据 怎么判断extjs 中gridpanel中是否存在数据 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 var count=grid.getStore().getCount()得到数据条数。如果count>0则存在数据,否则,不存在。 gridpanel 有个属性叫 emptyText 它可以判断。var grid = new Ext.grid.GridPanel({ .... viewConfig:{ .... emptyText:'No rows to display' }, ....}); 不是这个效果,就是当我gridpanel 在没有可显示的数据就要隐藏,当有数据的就显示,var count=grid.getStore().getCount() ,这个也用了,但每次都是count = 0 var grid2 = new Ext.grid.GridPanel({ id : "grid2", renderTo : Ext.getBody() //省略...100行 }); vstore.load(); if (grid2.getStore().getCount() < 1) { alert("隐藏"); Ext.get("grid2").hide(); } else { alert("显示"); Ext.get("grid2").show(); } 先给grid设置属性 hidden:true然后在store中添加属性:listeners:{ "load":function(store,records,optins) { var count=records.length; //等于var count=grid.getStore().getCount() if(count<1) //count==0 { grid.hide(); } else { grid.show(); }}如果grid.getStore().getCount() 总是等于0的话,你的数据是不是没有传过来? 后台是有数据的,只是在选择条件查询的时候可能没数据,但我就希望查询到没数据的时候把这个gridpanel给隐藏起来,如果查询到有数据的时候就显示出来 我写在6楼的代码就是你要的功能啊监听加载以后的数据,如果有数据则grid显示,如果没有数据则grid隐藏 jquery显示中下拉菜单单独操作 回车控制焦点移动 求Extjs 表格的增删改查 (来者有分) 网页幻灯片——请帮忙补充代码 一个正则帮着改进一下 求一段JS替换后排序并显示出来的问题 谈谈你对JavaScript 函数库的理解. 有什么方法让页面开始加载就执行JS函数? EXTjs通过表单按钮提交参数返回数据显示到grid中 高分求DIV滚动条的解决办法 怎么才能使gridpanel 中的数据每列之间都有一条竖线 jquery问题!求助啊!
....
viewConfig:{
....
emptyText:'No rows to display'
},
....
});
var count=grid.getStore().getCount() ,这个也用了,但每次都是count = 0
id : "grid2",
renderTo : Ext.getBody()
//省略...100行
}); vstore.load(); if (grid2.getStore().getCount() < 1) {
alert("隐藏");
Ext.get("grid2").hide();
} else {
alert("显示");
Ext.get("grid2").show();
}
然后在store中添加属性:listeners:
{
"load":function(store,records,optins)
{
var count=records.length; //等于var count=grid.getStore().getCount()
if(count<1) //count==0
{
grid.hide();
}
else
{
grid.show();
}
}
如果grid.getStore().getCount() 总是等于0的话,你的数据是不是没有传过来?
监听加载以后的数据,如果有数据则grid显示,如果没有数据则grid隐藏