网格实时搜索extjs

grid live search extjs

本文关键字:extjs 搜索 实时 网格      更新时间:2023-09-26

我的实时搜索网格works fine,但当我点击下一页或做关于网格的其他事情时,搜索网格失去高亮项搜索,有人帮我做什么吗?我想保持高亮的条款搜索在所有页面。由于

显示我的代码片段:

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

所以我回答了我自己的问题,我已经创建了一个highlight()方法并将其放在容器上:每次单击字段搜索输入后,高亮显示留在搜索条件上:;)

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