日期:2014-05-17  浏览次数:20647 次

Extjs做一个判断具体该如何?
Extjs中我想做一个是否有返回值的判断,如果有返回值则显示返回值,没有返回就刷新,
可是不了解怎么写判断中的属性!!!
hx.request({
url:'ScreenGroupController/judgeBoxId',
params : boxId,
callback:function(){
//判断boxid是否有效.有效的话
if(){

}else{
grid.getStore().reload({params:{start:0}});
}
}
});
public static void judgeBoxId(Integer boxId){
if(boxId != null ) {
ScreenGroupBoxItem sgb = ScreenGroupBoxItem.find("from ScreenGroupBoxItem where nid=?", boxId).first();
if(sgb != null){
return ;
}else{
Map map = ExtJsMessage.createAlertMessage(false, 0, "BoxId错误", "BoxId未注册", ExtJsMessage.ICON_ERROR);
renderJSON(map);
return ;
}

}
}

------解决方案--------------------
callback:function(rsp){
var result = rep.responseText;
if(result == ''){
//do something
}
还有如果是Exjt Ajax的话,可以参考success:function(rsp){},fail:function(rsp){}