2
votes

My live search grid works fine but when I click on next page or do other thing about the grid, the search grid lose highlight terms search,does anyone help me what do I do? I want to keep highlighted terms search in all page. Thanks

bellow a snippet of my code:

var pagingStore = Ext.create('Ext.data.Store', {
    proxy: {
        type: 'memory',
        enablePaging: true
    },
    remoteFilter: true,
    pageSize: 5
}),
        remoteStore = Ext.create('Ext.data.Store', {
            autoLoad: true,
            proxy: {
                type: 'ajax',
                url: 'js/json/pagingStore.json',
                reader: {
                    rootProperty: 'items'
                }
            },
            fields: ['name', 'email', 'phone', 'type']
        });
remoteStore.load(function () {
    pagingStore.getProxy().setData(remoteStore.getRange());
    pagingStore.load();
});
var bbar = new Ext.PagingToolbar({
    store: pagingStore, //the store you use in your grid
    displayInfo: true,
    items: [ {
            xtype: 'textfield',
            name: 'searchField',
            id: 'txtfield',
            fieldLabel:'Search:',
            labelAlign:'right',
            emptyText:'search...',
            width: 300,
            listeners: {
                change: {
                    fn: onTextFieldChange
                }
            }
        }
    ]
});
bbar.down('#refresh').hide();
Ext.create('Ext.grid.Panel', {
    height: 400,
    title: 'Simpsons',
    id: 'gridPanel',
    store: pagingStore,
    columns: [{
            text: 'Name',
            dataIndex: 'name',
            filterable: true
        }, {
            text: 'Email',
            dataIndex: 'email'
        }, {
            text: 'Phone',
            dataIndex: 'phone'
        },
        {
            text: 'Type',
            dataIndex: 'type'
        }],
    bbar: bbar,
    renderTo: Ext.getBody()
});
1
show grid and its related code - Flying Gambit
I've edited my post above - Joy
You can add the js/json/pagingStore.json file and the function onTextFieldChange? - Alexandre Neukirchen
@Alexandre you are so curious ;) you can find out here an example examples.sencha.com/extjs/5.0.0/examples/grid/… - Joy

1 Answers

1
votes

So I answer my own question, I've created a highlight() method and put it on the container: after field search input on each click, the highlight stay on the search terms: ;)

cont.getEl().on({
        click: {
            fn: highlight
        }
    });