1
votes

I have done app using Extjs. I am showing grid records to user, here added feature of livesearch. by entering some text in the field of search field, filtering is happening very nicely based on property name and value. but issue is once i deleted text from search field when search field is becomes empty/blank that time original store data is not populating in the grid. How can i populate original store data to grid once search text field becomes empty? appreciate.

My code is here: incode newValue is search textfield value i am checking if else part. if newValue null means need to load original store else it will filter store and display the records. i have added below code to reload original store is not working.

{
    xtype: 'textfield',
    name: 'searchField',
    hideLabel: true,
    width: 200,
    listeners: {
        change: {
            fn: this.onTextFieldChange,
            scope: this,
            buffer: 100
        }
    }
},

onTextFieldChange: function (field, newValue, oldValue, options) {
    if (newValue == '') {
        //grid.setStore(store);
        Ext.getCmp('grid').getStore().load();
        here grid is id of my Grid
        Ext.getCmp('grid').getView().refresh();
    } else {
        grid.store.load().filter([{
            id: 'name',
            property: "name",
            value: newValue,
            anyMatch: true
        }]);
    }
}
1
We need more information about your store and maybe your serverside code. In most cases store.load() performs a kind of store reset.user1703279
Thank you for reply. I have tried to clear the filter. in the case of search text box field is empty. Working fine.Ramesh Lamani

1 Answers

1
votes

i have am added grid.store.clearFilter(); to clear the filter once search text field is empty. Working fine. Cheers :)