我的实时搜索网格 工作正常
但是当我单击下一页或对网格进行其他操作时,搜索网格会丢失突出显示的术语搜索,有人帮我做什么吗?我想在所有页面中保留突出显示的术语搜索。谢谢
下面是我的代码片段:
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/