我初学ext看到前辈们写的一个方法是document.location = “bookList!export2Excel”
这样能跳转到bookList里面的export2Excel方法。我也一样写了这个方法。
他就跳转到struts.xml里面的input的页面。很奇怪。。我不知道问题出在那里。求前辈们解答。
还有遇到一个问题是,
我在后台把添加和修改写在一起。
所以我用一个事件
//修改信息
harListgrid.on('rowclick',function(harListgrid,rowIndex,event){
var record = harListgrid.getStore().getAt(rowIndex);
harInfoForm.getForm().loadRecord(record);
harInfoForm.buttons[0].setText('修改');
harInfoForm.buttons[1].setText('取消');
harInfoForm.buttons[1].setHandler(function(){
harInfoForm.buttons[0].setText('添加');
harInfoForm.getForm().reset();
harInfoForm.buttons[1].setText('重置');
});
});
把添加的字样给改了。。添加的方法是这样:
harInfoForm.getForm().doAction('submit',{
url:'/liuycTest3/addOrUpdate.action',
method:'post',
params:'',
success:function(form,action){
if(action.result.msg == 'add'){
Ext.Msg.alert('消息',"添加成功!!");
}else if(action.result.msg == 'update'){
Ext.Msg.alert('消息'," 修改成功!!");
harInfoForm.buttons[0].setText('添加');
}
harInfoForm.getForm().reset();
document.location = 'harInfoList.jsp';
},
failure:function(){
Ext.Msg.alert("提示","操作有误!!");
}
});
很奇怪的是添加可以添加。
但是一到修改就直接到failure这边了。。
昨天一前辈帮我用ajax不传递参数能进入到action
后来回家我自己在改成这样:
if(this.text=='修改'){
getHarInfoStore();
Ext.Ajax.request({
url:'addOrUpdate.action',
params:{
id:harId,
parId:parId,
code:code,
brand:brand,
model:model
},
success:function(){
}
})
}else{
harInfoForm.getForm().doAction('submit',{
url:'/liuycTest3/addOrUpdate.action',
method:'post',
params:'',
success:function(form,action){
if(action.result.msg == 'add'){
Ext.Msg.alert('消息',"添加成功!!");
}else if(action.result.msg == 'update'){
Ext.Msg.alert('消息'," 修改成功!!");
harInfoForm.buttons[0].setText('添加');
}
harInfoForm.getForm().reset();
document.location = 'harInfoList.jsp';
},
failure:function(){
Ext.Msg.alert("提示","操作有误!!");
}
});
}
}
});
还是能添加,但是到修改依然挂掉。。。求解!!!!
我只有三十分。全给了。求解!!!