ext里如何实现当grid里内容为空返回信息那?即store没取得数据报个信息到前台
[b]问题补充:[/b]
to yourgame:代码里thiz是啥意思看不明白
[b]问题补充:[/b]
to yourgame:如何扑获store的异常如何返回到前台那
ext里如何实现当grid里内容为空返回信息那?
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
6条回答 默认 最新
- zhoujuan520 2009-07-21 14:21关注
你可以去看下store的api他还有两个事件
exception : ( misc misc )
Fires if an exception occurs in the Proxy during a remote request. This event is relayed through the corresponding Ext.data.DataProxy. See Ext.data.DataProxy.exception for additional details.
loadexception : ( misc misc )
This event is deprecated in favor of the catch-all exception event instead.
This event is relayed through the corresponding Ext.data.DataProxy. See Ext.data.DataProxy.loadexception for additional details.
Listeners will be called with the following arguments:* misc : misc See Ext.data.DataProxy.loadexception for description.
其实我知道你的意思,并不是说捕捉store的什么异常
你的意思肯定是说当你加载数据的时候,后台发生了异常,这个怎么呈现给前台对吧?
我一般是这样的,哪struts2来说,在action里面有一个属性
[code="java"]
public class TestAction extend ActionSupport{
private Map infos = new HashMap();
//setter,getter
public String method(){
if(发生错误){
this.infos.put('msg','错误信息');
}
}
}[/code]然后配置的时候可以这样来配置
[code="xml"]
true
infos.*
[/code]
然后前台你可以这样来处理
[code="js"]
Ext.Ajax.request({
url: 'ajax_demo/sample.json',
success: function(response, opts) {
var obj = Ext.decode(response.responseText);
alert(obj.infos.msg);//弹出错误
},
failure: function(response, opts) {
console.log('server-side failure with status code ' + response.status);
}
});[/code]本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥15 对于相关问题的求解与代码
- ¥15 ubuntu子系统密码忘记
- ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
- ¥15 保护模式-系统加载-段寄存器
- ¥15 电脑桌面设定一个区域禁止鼠标操作
- ¥15 求NPF226060磁芯的详细资料
- ¥15 使用R语言marginaleffects包进行边际效应图绘制
- ¥20 usb设备兼容性问题
- ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊
- ¥15 安装svn网络有问题怎么办