我不明白如何創建兩個日期列並在它們之間創建範圍?extjs網格過濾日期範圍
例如,我有Grid
其中一些列(deadline date
),和我有2個datefields,哪裏可以寫:From what day
和Till what day
。
那麼我可以如何篩選那些我選擇的日子之間的數據?
**SOME CODE:**
// create the Grid
var grid = new Ext.grid.GridPanel({
store : store,
id : 'grid',
columns : [
new Ext.grid.RowNumberer({width: 20, header: '#'}),
{id:'text',header: "Text", width: 150, sortable: true, dataIndex: 'text'},
{id:'is_online',header: "Is Online?", width: 70, sortable: true, dataIndex: 'is_online'},
{id:'deadline',header: "Deadline", width: 130, sortable: true, dataIndex: 'deadline', xtype: "datecolumn", format: "Y-m-d"}
],
stripeRows : true,
height : 550,
title : 'Questions',
});
var gridSearch = new Ext.Panel({
stripeRows : true,
frame : true,
style : 'padding-bottom: 5px',
height : 250,
title : 'Search filter',
items : [{
xtype : 'checkbox',
id : 'is_for_online',
boxLabel : 'Показать только ОНЛАЙН',
inputValue : '1'
},{
xtype : 'datefield',
id : 'date_s',
allowBlank : true,
emptyText : 'Выберите дату С',
name : 'deadline',
width : 140,
editable : false,
format : 'Y-m-d'
},{
xtype : 'datefield',
id : 'date_s',
allowBlank : true,
emptyText : 'Выберите дату С',
name : 'deadline',
width : 140,
editable : false,
format : 'Y-m-d'
},{
xtype : 'button',
text : 'Go!',
handler : function() {
//var searchValueDate1 = Ext.getCmp("date_s").getValue();
//var searchValueDate2 = Ext.getCmp("date_po").getValue();
//var date_s = searchValueDate1.format('Y-m-d');
//var date_po = searchValueDate2.format('Y-m-d');
//store.filter("deadline", date_s)//, date_po);
alert(daterange);
}
},
]
});
感謝您的迴應! Exaxtly我需要你寫對。但我不明白如何在extjs中獲得範圍。我的意思是,我得到每一行的最後期限,是的,以及如何檢查?我不明白這個部分。我應該寫ifth(deadLineDate == startDate ..?) – 2011-12-15 12:13:51