2011-12-14 56 views
0
fbar :[{ 
        xtype  : 'datefield', 
        id   : 'date_s', 
        allowBlank : true, 
        emptyText : 'Choose date', 
        name  : 'deadline', 
        width  : 120, 
        editable : false, 
       },{ 
        xtype  : 'button', 
        text  : 'Go!', 
        handler  : function() { 
        /*f.load({ 
         params : { 
          start : 0, 
          limit : 2, 
          t : '' 
         } 
        });*/ 

        var clear = f.clearFilter(); 
        var searchValueDate1 = Ext.getCmp("date_s").getValue(); 
        var date1 = searchValueDate1.format('Y-m-d); // 00:00:00'); 

        //alert(date1); 

        //clear; 
        f.load().filter("question[deadline]", date1); 

        } 
       }] 

我創建組合框在那裏我可以選擇任何日期,然後當我點擊按鈕 - >它只顯示僅與該日期9deadline日期行) 問:我想我寫的一切是正確的,但沒有工作!主要問題是什麼?ExtJS的3(電網濾波器)

回答

0

你說的不工作呢?你有錯誤嗎?

在ExtJS的3,過濾器,你必須,如果你需要的陷阱更改數據之前過濾做一個小工具,讓你有一個視覺特徵來選擇一個日期,然後,它推出一個事件(負載)通過控制器(在ASP/PHP)

好東西是給我們一個完整的測試代碼簡單地過去,在我們的環境

0

的處理程序獲取傳遞給它的按鈕和事件對象。因此,處理程序應該是這樣的:

handler  : function (b,e) { 

var theGrid = Ext.getCmp('gridId'); //You need to get the grid to filter 
var theStore = theGrid.store; //Get the grid store you need it to filter 

var searchValueDate1 = Ext.getCmp("date_s").getValue(); 
var date1 = searchValueDate1.format('Y-m-d); // 00:00:00'); 


//Filter by filters each record if true it keeps it if false it filters it out 
theGrid.filterBy(function(rec){ 

if(rec.get('dateField') == date1){ 
    return true 
}else{ 
return false; 
} 
}); 

} 

這是基本的想法的這種複製和粘貼將無法正常工作,這意味着更多的作爲指導。