Ext.Net/Ext JS_Ext.Net.Store检索(6)
来源:未知 责任编辑:责任编辑 发表时间:2014-05-10 12:25 点击:次
};
var yourFindBy = function(store, findByValue) {
var index = store.findBy(function(r) {
return r.data.Light == findByValue;
}, this, 0);
if (index < 0)
alert('未找到.');
else
alert(store.getAt(index).data.Id + " " + store.getAt(index).data.Common);
};
var yourFindExact = function(store, findExactValue) {
var index = store.findExact('Light', findExactValue, 0);
if (index < 0)
alert('未找到.');
else
alert(store.getAt(index).data.Id + " " + store.getAt(index).data.Common);
}
</script>
Store.queryBy(…)
queryBy( Function fn, [Object scope] ) : MixedCollection
通过一个过滤函数,在 Store 中,查找已缓存的 Recors。Store 中的每个 Record 都会调用过滤函数。若该函数返回 true,则该 Record 包含在结果中。
Store.queryBy(…) 与 Store.find*** 的区别:前者返回一个集合,该集合是一个脚本类,不同于 Records,而后者只是返回索引;前者返回所有匹配过滤函数的 Record,而后者只是返回第一个匹配的 Record。
<script type="text/javascript">
var yourQueryBy = function(store, queryByValue) {
var records = store.queryBy(function(record) {
return record.data.Light == queryByValue;
}, this);
if (records.length > 0) {
var vals = [];
Ext.each(records.items, function(r) {
vals.push(r.data.Id + "-" + r.data.Common);
}, this);
Ext.net.Notification.show({
iconCls: 'icon-information',
pinEvent: 'click',
相关新闻>>
- 已知Random.Next(1,10),产生1至100不重复的随机数据
- 用OpenXml在文档的尾部添加一个Rich Text Content Control/Plain
- .net编程中的javascript中调用textbox控件
- asp.net中TextBox设为只读后的取值问题
- 解决ASP.NET 在IIS 7中提示EXT未定义的错误
- 用OpenXml在文档的尾部添加一个Rich Text Content Control/Plain
- 使用 iTextSharp 生成 PDF 表格
- 线程间操作无效: 从不是创建控件“textBox2”的线程访问它。
- OutputCache造成页面响应内容类型为text/vnd.wap.wml的问题
- 线程间操作无效: 从不是创建控件“textBox2”的线程访问它。
最新推荐更多>>>
- 发表评论
-
- 最新评论 进入详细评论页>>