extjs使用store加载远程数据chart报错
来源:互联网 发布:怎么算开通了淘宝客 编辑:程序博客网 时间:2024/06/05 02:59
extjs使用store加载远程数据到chart组件时,出现警告信息
在firebug中可见日志输出如下:
Unexpected value NaN parsing height attribute.
Unexpected value NaN parsing y attribute.
此处store数据是来自solr查询结果,chart为pie饼图类型,其它类型图表未做测试。
由于store中的数据是动态从远端服务器获取的,在store提供给chart时,store中的数据一般情况下是空的,这时chart使用空的store就会出现上面的警告信息。
解决的办法就是在store加载数据成功之后才去创建chart,这样就能保证是有数据的store了,自然也不会出现警告了。
以下是部分代码:
// 定义数据模型
Ext.define('MyChart', { extend : 'Ext.data.Model', fields : [{name : 'type',mapping : 'groupValue' }, {name : 'num',mapping : 'doclist.numFound',type : 'int' }]});
// 定义store
var store = Ext.create('Ext.data.JsonStore', { model : 'MyChart', proxy : {type : 'ajax',url : 'solr/select/',reader : { type : 'json', root : 'grouped.someField.groups'},extraParams : { 'fl' : '*', 'q' : '*:*', 'group' : true, 'group.field' : 'someField', 'group.ngroups' : true, 'wt' : 'json'} }});
// 加载数据,成功后绘制chart
store.load({ callback : function(r, options, success) {if (success == false) { // show some error message} else { // create chart} }});
转载地址:http://flyash.itcao.com/post_1142.html
- extjs使用store加载远程数据chart报错
- extjs-store数据加载
- Extjs Grid store加载数据
- EXTJS的Store加载
- extjs store load 加载数据参数和分页时参数设置
- extjs 4 chart 使用 后台发送的json数据画图
- Extjs Store使用
- ExtJs的Store在加载
- Extjs 代理加载grid store
- ExtJS的FormPanel中的组件使用load加载远程的JSON数据的方法
- ExtJs中的store获取数据
- Extjs 获取Store的数据
- ExtJS ComboBox同时加载远程和本地数据
- (24)ExtJS之表格加载远程数据及其分页显示
- extjs的store默认加载数据时,增加本地一条数据
- ExtJs中Store的使用
- ExtJS动态改变grid的store的url地址,重新加载grid的数据
- Extjs Ext.data.store 捕获加载数据的异常,并打印信息
- 封usb接口的方法
- pointcut 案例配置
- 汇总Extjs中GridPanel的各个属性与方法
- 2013-1-23 - 1-24 11gR2 "Performance Tuning Guide" page 142 - 151
- 详细介绍Linux重定向的使用
- extjs使用store加载远程数据chart报错
- 如何突破学习的瓶颈?
- MYSQL主从同步故障
- 10304 平面域着色
- 二分图匹配
- DecimalFormat 格式化输出数据
- The first GTK+ Program
- JS中offsetTop、clientTop、scrollTop、offsetTop各属性介绍
- ubuntu软件删除方法