var tbRow = new Ext.Toolbar({
items : [{
//红色部分是我自己写的,下拉框中要求有两个选项:发生时间(value=0)和终止时间(value=1),求大神帮忙写下
text : '时间类型:'
}, {
id : 'time_type',
xtype : 'combo'
}, {
text : '起始时间:'
}, {
id : 'happentime_query_start',
xtype : 'datefield'
}, {
text : '截止时间:'
}, {
id : 'happentime_query_end',
xtype : 'datefield'
}, {
text : '营业号:'
}, {
id : 'samcode_query',
xtype : 'numberfield',
width : '10%'
}, {
text : "查询",
handler : function() {
var happentime_start = Ext.util.Format.date(Ext
.getCmp('happentime_query_start')
.getValue(), "Y-m-d");
var happentime_end = Ext.util.Format.date(Ext
.getCmp('happentime_query_end')
.getValue(), "Y-m-d");
if ((happentime_start == null || happentime_start == ""
|| happentime_end == null || happentime_end == "")) {
alert("请选择查询日期!");
} else if (happentime_start.split("-")[0] == happentime_end
.split("-")[0]
&& parseInt(happentime_start.split("-")[1]) == (parseInt(happentime_end
.split("-")[1]) - 1)
&& (parseInt(happentime_start.split("-")[2]) > parseInt(happentime_end
.split("-")[2]))) {
grid.getStore().loadPage(1);
} else if (happentime_start.split("-")[0] == happentime_end
.split("-")[0]
&& parseInt(happentime_start.split("-")[1]) == parseInt(happentime_end
.split("-")[1])
&& (parseInt(happentime_start.split("-")[2]) <= parseInt(happentime_end
.split("-")[2]))) {
grid.getStore().loadPage(1);
} else {
alert("查询日期间隔为1个月,请重新选择查询日期范围!!");
}
}
}]
});
生成的页面效果: