//起始日期
var sDate_his_trade = new Ext.form.DateField({
id:'sDate_his_trade',
format:'Y-m-d',
width:120,
paramName:'_TradeDate[>=][Date]'
});
//截止日期
var eDate_his_trade = new Ext.form.DateField({
id:'eDate_his_trade',
format:'Y-m-d',
width:120,
paramName:'_TradeDate[<=][Date]'
})
var tolbar2_his_trade = new Ext.Toolbar({
height:25,
items:[{
xtype:'tbspacer'
},
{
xtype:'tbspacer'
},
{
xtype:'tbspacer'
},
{
text:"起始日期:",
xtype:'tbtext'
},
sDate_his_trade,
{
xtype:'tbspacer'
},
{
text:"~",
xtype:'tbtext'
},
{
xtype:'tbspacer'
},
{
text:"截止日期",
xtype:'tbtext'
},
eDate_his_trade,
{
xtype:'tbfill'
},
{
xtype:'tbbutton',
text:'查询',
handler:function(){....}
}
]
});
我怎样将文本框中的内容传递到后台,后台怎样获取?
吧相应value值相加成你规定的格式.
key : '__TradeDate['+value+']'
后台在对这种格式进行解析就行了。
var value = Ext.getCmp('').getValue();//根据id获取文本框值
通过Ext.Ajax.request({
url:'',
params:{ //参数设置 key,value
key:value
}
})
如果使用gridPanel数据加载
gridPanel.getStore().baseParams = {
key : value
}
gridPanel.getStore().load();
后台根据key名称获取值
Ext应该对ajax包装过,可以用ajax以提交参数的方式后台。
代码很难看,你应该是在点“查询”的时候要提交到后台吧
//在handler:function()添加下面代码
handler:function(){
Ext.Ajax.request({
url: 'xxxxx',
success: function(){//....成功回调},
failure: function(){//....失败回调},
params: {beginDate: xxxx, endDate: xxxxx}
});
}