javascript - 网格实时搜索 extjs

标签 javascript search extjs highlight

我的实时搜索网格 工作正常 但是当我单击下一页或对网格进行其他操作时,搜索网格会丢失突出显示的术语搜索,有人帮我做什么吗?我想在所有页面中保留突出显示的术语搜索。谢谢

下面是我的代码片段:

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

关于javascript - 网格实时搜索 extjs,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40021694/

相关文章:

javascript - 为什么我总是需要在 Backbone 中克隆模型属性?

javascript - requestAnimationFrame代码执行时间

javascript - 从 API 获取实时数据到路由

javascript - 按钮文本对齐中的 iconCls - EXTJS

javascript - Openlayers - LayerRedraw()/特征旋转/线串坐标

javascript - React 中的 Import() - 在 Chrome/Firefox 扩展中引发错误

java - 在 JFrame 中搜索

linux - linux中如何从文本文件中获取值

search - 如何在elasticsearch中配置synonyms_path

extjs - Sencha2 - 如何从面板获取数据到子字段集组件?