extjs使用store加载远程数据chart报错
2013-01-24 22:46
435 查看
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了,自然也不会出现警告了。
以下是部分代码:
// 定义数据模型
// 定义store
// 加载数据,成功后绘制chart
转载地址:http://flyash.itcao.com/post_1142.html
在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的FormPanel中的组件使用load加载远程的JSON数据的方法
- ExtJS动态改变grid的store的url地址,重新加载grid的数据
- Ext.data.JsonStore使用HttpProxy加载数据时传递参数的两种方法
- ExtJS ComboBox同时加载远程和本地数据
- (24)ExtJS之表格加载远程数据及其分页显示
- Extjs combo远程加载数据
- Sencha(Extjs) Ext.data.Store与Reader结合加载多重嵌套数据对象
- Extjs Ext.data.store 捕获加载数据的异常,并打印信息
- 在使用ext2.0中使用store加载数据出现this.onMetaChange has no properties错误
- ExtJS ComboBox同时加载远程和本地数据
- ExtJS中store自动加载数据的时候,在firebug下http status为Aborted时的处理方法
- extjs JsonStore加载数据,Combobox只显示最后一项值问题
- extjs store load 加载数据参数和分页时参数设置
- ExtJS学习笔记2:响应事件、使用AJAX加载数据
- ExtJS中表格控件的使用,属性设置和数据的获取加载
- extjs JsonStore加载数据,Combobox只显示最后一项值问题
- 关于ligerui 中 grid 表格的扩展搜索功能在远程数据加载时无法使用的解决办法
- extjs的store默认加载数据时,增加本地一条数据
- extjs JsonStore加载数据,Combobox只显示最后一项值问题
- Sencha(Extjs) Ext.data.Store与Reader结合加载多重嵌套数据对象