最近在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:
关键在这里,经过反复查找发现是因为开始没有写
infinite: true,所以会有卡顿现象
id : 'clientList',
disableSelection: true,
scrollable : 'vertical',
xtype : 'list',
store : "app0010000002Store",
flex : 1,
itemTpl : new Ext.XTemplate("<div><span>{customerName}</span></div>"),
infinite: true,
分享到:
相关推荐
web 应用的 JavaScript 框架,它基于 HTML5 和 CSS3 的 web 标准,全面兼容 Android 和 Apple iOS,通过 Sencha Touch 框架用户可以创建非常像移动设备本地应用的 web 应用,它提供了丰富的华丽的控件和强大的功能,...
sencha touch中文翻译文档,包含sencha touch入门基础和一些控件的使用说明
Sencha Touch开发的项目《般若人生》源码
sencha touch 应用案例 sencha touch 案例 一个完整的sencha touch 应用案例 移动WEB社区开发的日志案例 非常不错!
sencha touch 折叠list
MAC OS 下sencha touch +cordova 开发环境配置。可以将H5 hybird 应用打包成IOS 应用。
sencha touch 2.4.0最新版 原版包下载
Sencha Touch 2入门教程之MVC 讲解如何使用 Sencha Touch 2 mvc模式来开发一个登录界面
sencha touch list demo
sencha touch cookbook 英文高清文字版 !
sencha touch 是一个移动平台UI开发框架,可以实现各种绚丽的页面效果
sencha touch动态加载组件及容器内容,防止加载时间过长的问题
这是我做的一个sencha touch 的项目,测试并能运行,希望对大家有帮助
sencha touch grid
《Sencha Touch 权威指南》陆凌牛著的源码包
sencha touch2移动开发框架,ajax获取数据
sencha touch sdk工具
sencha touch 2 实现的贪吃蛇 希望对大家有所帮助