Ext页面根据查询条件 得出的List数据在action已经得到了 怎么在GridPanel中重新加载一次呢?Ext.getCmp('Ext.system.logFormPanel').form.submit({
url : BASE_PATH + '/system/QueryLogByCond.action',
waitTitle : '提示',
method : 'POST',
waitMsg : '正在提交数据,请稍候.....',
success : function(form, action) {
logGridPanel.store.proxy
// 刷新表格
logGridPanel.store.reload({ params : { start : 0, limit : 15} });
},
failure : function(form, action) {
Ext.Msg.alert("提示", "返回数据出错!");
},
scope : this
});
url : BASE_PATH + '/system/QueryLogByCond.action',
waitTitle : '提示',
method : 'POST',
waitMsg : '正在提交数据,请稍候.....',
success : function(form, action) {
logGridPanel.store.proxy
// 刷新表格
logGridPanel.store.reload({ params : { start : 0, limit : 15} });
},
failure : function(form, action) {
Ext.Msg.alert("提示", "返回数据出错!");
},
scope : this
});
可以直接把数据插入到 store中去。
2.可以store.load({params:{}});
reload方法不带参数
if (!Ext.getCmp('Ext.system.logFormPanel').form.isValid()) {
Ext.MessageBox.alert('提示', '请将数据填写完整');
return;
}
Ext.getCmp('Ext.system.logFormPanel').form.submit({
url : BASE_PATH + '/system/QueryLogByCond.action',
waitTitle : '提示',
method : 'POST',
waitMsg : '正在提交数据,请稍候.....',
success : function(form, action) {
// 刷新表格
logGridPanel.store.reload({ params : { start : 0, limit : 15} });
},
failure : function(form, action) {
Ext.Msg.alert("提示", "返回数据出错!");
},
scope : this
});
}
url: BASE_PATH + '/system/QueryLogByCond.action',
waitTitle: '提示',
method: 'POST',
waitMsg: '正在提交数据,请稍候.....',
success: function(form, action) {
//这里是不是返回了正确的数据
var result = Ext.decode(action.result);
store.loadData(result);
},
failure: function(form, action) {
Ext.Msg.alert("提示", "返回数据出错!");
},
scope: this
});//其实你完全不用这种方法来做的//查询grid建议这样做
store.load({ params: Ext.apply({ start: 0, limit: 15 }, Ext.getCmp("Ext.system.logFormPanel").form.getValues()) });
//这样就直接加载到grid中了。
//用到分页的话就要用store.setBaseParam方法了。
search = function(){
Ext.getCmp('Ext.system.logFormPanel').form.submit({
url : BASE_PATH + '/system/QueryLogInfo.action',
waitTitle : '提示',
method : 'POST',
waitMsg : '正在提交数据,请稍候.....',
success : function(form, action) {
var result = Ext.decode(action.result);
logGridPanel.store.loadData(result);
// 刷新表格
// logGridPanel.store.reload({ params : { start : 0, limit : 15} });
},
failure : function(form, action) {
Ext.Msg.alert("提示", "返回数据出错!");
},
scope : this
});
}
我在后台使用的是struts2/**
* 查询日志信息, 用于显示在GridPanel 中
* */
public String queryLogInfo(){
success = true;
// 获取ActionContext对象,通过context对象获取页面请求参数
ActionContext context = ActionContext.getContext();
Map params = context.getParameters();
// 获取表单页面元素start
String[] starts = (String[]) params.get("start");
String start = "";
if (starts != null && starts.length > 0) {
start = starts[0];
}
// 获取表单页面元素limit
String[] limits = (String[]) params.get("limit");
String limit = "";
if (limits != null && limits.length > 0) {
limit = limits[0];
}
logInfoList = service.queryLogInfo(start, limit, startTime, endTime, keyWord);
try {
totalCount = service.queryCount();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return SUCCESS;
}
你search时只需要重新设置store的baseParams即可