当前位置:网站首页>Sencha touch中Ext.data.Store获取json串中key值的方法
Sencha touch中Ext.data.Store获取json串中key值的方法
2022-08-09 00:26:00 【西山水壶】
最近项目需要在Ext.data.Store返回列表的同时也返回其他一些值,但是查看store的api发现没有获取额外key值的方法,后来发现store的load方法中的回调函数有个operation参数,代码如下:
store.loadPage(1,{
callback: function(records, operation, success) {
},
scope: this
});查看api发现 operation是Ext.data.Operation类型,里面有个getResponse( )方法,返回的response对象中有个responseText属性,里面就是store要用的一个完整的json串,于是将其转化为对象,使用eval方法:var obj=eval('('+operation.getResponse().responseText+')'),然后就可以使用这个对象获取key值了,获取方法为:obj.要获取的key,例如:obj.sum,obj.count等。
边栏推荐
猜你喜欢

Using MySQL in Ubuntu/Linux environment: Modify the database sql_mode to solve the "this is incompatible with sql_mode=only_full_group_by" problem

《MySQL入门很轻松》第3章:数据库的创建与操作

阿里云服务器买完不知道如何使用(新手入门教程)

全新Swagger3.0教程,OAS3快速配置指南,实现API接口文档自动化!

笔记&代码 | 统计学——基于R(第四版) 第十一章 时间序列预测

Risk Control Modeling IV: Logistic Regression Scorecard Development

整流十二 -有效值、平均值、瞬时值、幅值的关系以及相关方法

Unified identity management platform IAM single sign-on process and third-party interface design scheme

WeChat applet console error - summary 】 【

在Ubuntu/Linux环境下使用MySQL:解决com.mysql.jdbc.PacketTooBigException: Packet for query is too large的问题
随机推荐
2021.10.7 2020 CCPC重现赛
aspx结尾文件网站的发布过程
10月自学考试结束后总结
[Deep Learning] TensorFlow Learning Road 2: Introduction to ANN and TensorFlow Implementation
如何使用Rancher部署发布自己的web应用
半兰伯特光照模型
[GYCTF2020]Ezsqli-1|SQL注入
There is quality when someone is in charge: to a generation lost in the market place
Flutter -自定义日历组件
整流十二 -有效值、平均值、瞬时值、幅值的关系以及相关方法
笔记&代码 | 统计学——基于R(第四版) 第九章一元线性回归
基本控件属性
GaN图腾柱无桥 Boost PFC(单相)四(仿真理解)
ScreenSpace-ShadowMap(屏幕空间的阴影映射技术)
win10出现次磁盘占用率百分之百的情况
cmd切换硬盘的命令,从C盘切换到D盘怎么操作
【科研-学习-pytorch】6-数值计算
求区间(L, R)小于k的数有多少个
菲涅尔反射
神经网络基本原理