Search code examples
c#model-view-controllerextjsfilteringextjs3

Extjs 3.4 How can I read filter data in my controller?


I've got problem because I don't know how to read extjs data from my filtr

var search = new Ext.FormPanel({
             renderTo: 'search',
             frame: true,
             items: [searchForm],
             button: [{
               text:'Search',
               handler: function(){
                      store.ClearFilter();

                      var productValue = Ext.getCmp('filtrName').getValue();

                      var filters = [{
                           fn: function(item){
                                return (new RegExp(productValue).test(item. get('Name')));
                       }
                       }];
                   store.filter(filters);

}


             }]
)}

Filter working fine but I need to connect it with server side but don't know how. For example to take value from start limit etc to pagin side variable names are similar but here I don't have any clue how to get it

Please help


Solution

  • One option is to save the filter in the data store, which you can easily access from controller.

    For example, inside the button handler,

    store.filters = [{
        fn: function (item) {
            return (new RegExp(productValue).test(item.get('Name')));
        }
    }];
    store.filter(store.filters);
    

    And store.filters will be the one you can access from the controller. Hope it helps