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 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
- ¥88 找成都本地经验丰富懂小程序开发的技术大咖
- ¥15 如何处理复杂数据表格的除法运算
- ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
- ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
- ¥200 uniapp长期运行卡死问题解决
- ¥15 latex怎么处理论文引理引用参考文献
- ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
- ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
- ¥15 乘性高斯噪声在深度学习网络中的应用