sencha touch 使用searchfield控件卡顿现象

最近在sencha项目中做搜索功能时遇到卡顿现象,数据也不多就一百多条

以下是搜索代码

Controller:
onSearchKeyp: function(field) {
//get the store and the value of the field
var value = field.getValue(),
store = Ext.getStore('Customers');

//first clear any current filters on the store. If there is a new value, then suppress the refresh event
store.clearFilter(!!value);

//check if a value is set first, as if it isnt we dont have to do anything
if (value) {
//the user could have entered spaces, so we must split them so we can loop through them all
var searches = value.split(','),
regexps = [],
i, regex;

//loop them all
for (i = 0; i < searches.length; i++) {
//if it is nothing, continue
if (!searches[i]) continue;

regex = searches[i].trim();
regex = regex.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");

//if found, create a new regular expression which is case insenstive
regexps.push(new RegExp(regex.trim(), 'i'));
}

//now filter the store by passing a method
//the passed method will be called for each record in the store
store.filter(function(record) {
var matched = [];

//loop through each of the regular expressions
for (i = 0; i < regexps.length; i++) {
var search = regexps[i];
var didMatch = search.test(record.get('customerName'));

//if it matched the first or last name, push it into the matches array
matched.push(didMatch);
}

return (regexps.length && matched.indexOf(true) !== -1);
});
}
},


view:
关键在这里,经过反复查找发现是因为开始没有写[color=red]infinite: true[/color],所以会有卡顿现象
id : 'clientList',
disableSelection: true,
scrollable : 'vertical',
xtype : 'list',
store : "app0010000002Store",
flex : 1,
itemTpl : new Ext.XTemplate("<div><span>{customerName}</span></div>"),
infinite: true,
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值