我有一个自定义面板和图表,搜索gridPanel和Controller来检查点击搜索原始。我使用的控制器从gridPanel raw收集点击信息并将其写入商店。点击raw后,信息加载到商店,我知道它做得很好,因为store.load()的console.log回答它显示了我需要使用的所有数据,但是图表不希望显示。这是片段:
控制器:
this.control({
'Search': { //gridPanel component where we check information
selectionchange: this.SearchSelectionChange
}
});
},
SearchSelectionChange: function(arg, records) {
if (records.length > 0) {
var me = this;
var record = records[0];
me.code = record.data.dataset_code; //getting code from raw
me.store = Ext.create('Project.store.MarketDataStore'); //loading our store
me.store.getProxy().extraParams = {
code: me.code //applying code that we got from Search grid for MarketDataStore
};
me.store.load(function(records, success, options){
console.log(records); // shows me all data i want, it working correctly
if(records == null){Ext.Msg.alert('Error', 'Error');}
});
var chart = Ext.create('Project.view.Chart'); //Now i think Chart must be loaded?
chart.redraw(); //after this still no data in chart
}
面板:(图表预加载页面渲染)
Ext.define('Project.view.Panel', {
extend: 'Ext.panel.Panel',
requires: 'Project.view.Chart',
alias: 'widget.ChartPanel',
autoShow: true,
layout: 'fit',
items: [{
xtype: 'ProjectChart'
}]
});
一个图表组件:(系列和轴很好,检查硬编码数据)
Ext.define('Project.view.Chart', {
requires: ['Ext.chart.axis.Category','Ext.chart.axis.Numeric','Ext.chart.series.Line','Ext.util.Point', 'Project.store.MarketDataStore'],
extend: 'Ext.chart.Chart',
alias: 'widget.ProjectChart',
store: 'MarketDataStore',
storeId: 'сhart',
renderTo: Ext.getBody(),
animate: true,
autoShow: true,
检查图表应用程序的缩小版本,其中存储中的硬编码数据和图表加载良好。主要问题:如何从商店正确加载/重新加载/重绘图表?