onSearch method not working all time.

Hello, Thank you in advance,

I have developed my custom shopware backend plugin where i have added search field as same as available in inbuilt customer module, and added onSearch method to append the search text, it is workin fine at first time, but when i reopen the tab after closing it, it won’t work, how to solve ?

Here is the controller code.

 

   
    Ext.define(‚Shopware.apps.customEmployeePlugin.controller.list.Employee‘, {

        extend: ‚Shopware.apps.customEmployeePlugin.abstract.controller.List‘,

        configure: function() {
            return {
                eventAlias: ‚employee‘,
                gridClass: ‚Shopware.apps.customEmployeePlugin.view.employee.List‘,

                deleteConfirmTitle: ‚{s name=„employeeListing/deleteConfirmTitle“}Delete employees{/s}‘,
                deleteConfirmText: ‚{s name=„employeeListing/deleteConfirmText“}Are you sure you want to delete the selected employees?{/s}‘,
                deleteInfoText: ‚{s name=„employeeListing/deleteInfoText“} The employees will be deleted.
To cancel the process, you can use the Cancel process Button.{/s}‘,
                deleteProgressBarText: ‚{s name=„employeeListing/deleteProgressBarText“}Employee [0] of [1]{/s}‘,
                deleteCancelButtonText: ‚{s name=„employeeListing/deleteCancelButtonText“}Cancel process{/s}‘,
                deleteCloseButtonText: ‚{s name=„employeeListing/deleteCloseButtonText“}Close window{/s}‘,
                deleteSuccessHeader: ‚{s name=„employeeListing/deleteSuccessHeader“}Success{/s}‘,
                deleteRequestHeader: ‚{s name=„employeeListing/deleteRequestHeader“}Request{/s}‘,
                deleteErrorHeader: ‚{s name=„employeeListing/deleteErrorHeader“}Error message{/s}‘,
                deleteRequestResultTitle: ‚{s name=„employeeListing/deleteRequestResultTitle“}Request results{/s}‘,
                deleteProcessCanceledText: ‚{s name=„employeeListing/deleteProcessCanceledText“}Process canceled at position [0] of [1]{/s}‘
            };
        },

        onAddItem: function(grid) {

            Shopware.app.Application.addSubApplication({
                name: ‚Shopware.apps.Customer‘,
                action: ‚detail‘,
                params: {
                    corporationId: this.getCorporationDetailWindow().record.getId(),
                    corporationEditable: false
                }
            });

            return true;
        },

        onEditItem: function (grid, record) {

            if (!(record instanceof Ext.data.Model)) {
                return false;
            }

            Shopware.app.Application.addSubApplication({
                name: ‚Shopware.apps.Customer‘,
                action: ‚detail‘,
                params: {
                    corporationId: this.getCorporationDetailWindow().record.getId(),
                    corporationEditable: false,
                    customerId: record.getId()
                }
            });

            return true;
        },
          onSearch: function (grid, searchField, value) {
            var me = this, store = grid.getStore();
            value = Ext.String.trim(value);
            store.filters.clear();
            store.currentPage = 1;
            store.on(‚load‘, function() {
                Shopware.app.Application.fireEvent(me.getEventName(‚after-search‘), me, grid, store, searchField, value);
            }, me, { single: true });

            if (value.length > 0) {
                store.filter({ property: ‚search‘, value: value });
            } else {
                store.load();
            }

            return false;
        },

    });