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
}]);
}
}