chartscontrollerextjs4listenerwebtop

How to add listener for ExtJS4 chart series inside controller?


I would like to know how to add itemmouseup listener of an chart's series into controller?

My controller's init method is as follows :

init: function() {
    this.control({
        'candidateDistribution > treepanel' : {
            itemclick: this.treeStoreItemClickHandler
        },
        '#candidateDistributionButton' : {
            click: this.candidateDistributionButton_ClickHandler
        },
        'competitorAnalysis #slaWiseEmprDistriGrid series': {
            itemmouseup: this.sLA_ItemMouseUpEventHandler
        }
    });
},

In this case, itemmouseup event handler of organizationAnalysis #sLAWiseEmprDistriGrid series is not working but event handlers for rest of the things are working fine.

I tried to change Component Query to competitorAnalysis > #slaWiseEmprDistriGrid series or to competitorAnalysis > #slaWiseEmprDistriGrid[series] but its not working.

I had to add this itemmouseup event handler into code of chart's series which is working just fine but I think its breaking MVC pattern.

Code for my chart is as follows :

xtype: 'chart',
itemId: 'slaWiseEmprDistriGrid',
store: 'SLAWiseCompetitorDistribution',
flex: 2,
animate: true,
legend: {
    position: 'right'
},
insetPadding: 25,
series: [{
    type: 'pie',
    field: 'empCount',
    showInLegend: true,
    listeners: {
        'itemmouseup': function(item) {
            var record = item.storeItem;
            var slaWiseEmpListStore = Ext.data.StoreManager.lookup('SLAEmployerList');
            slaWiseEmpListStore.proxy.extraParams['paramFirstDimensionValue']= record.get('name');
            serviceLineWiseEmpListStore.load();
        }
    }
}] // end of series configuration

So I would like to know why this itemmouseup event handler is not working in controller?

Also in future I want to convert this app into web desktop like application, but I am not able to find information/documentation/tutorial on extjs documentation site. Where can I get tutorial/documentation about developing web desktop application?

Thanks in Advance !


Solution

  • You could setup this event in controller in 2 steps.

    1. Add listener to your chart render event
    2. In this listener setup your series events.

    Regarding desktop application - I only can suggest looking into this example: http://dev.sencha.com/deploy/ext-4.0.7-gpl/examples/desktop/desktop.html