PDA

View Full Version : create chart in extjs4.2.1 with a query between stores



waveform
19 Nov 2015, 4:57 AM
I'm working with a app that works with extjs4.2.1, geoext2 and openlayers2.
in this moment I have a grid with a wfs information like this:


var gridPanel = new Ext.grid.GridPanel({
title: "Propietats Municipals",
region: "south",
store: taulastore,
frame: true,
columns: [{
header: "Referčncia Cadastral",
dataIndex: "ref_cad"
}, {
header: "Nom",
dataIndex: "nom_edific"
}, {
header: "Tipus",
dataIndex: "tipus"
}],
selType: 'featuremodel',
listeners: {
itemclick: function() {var fts = vecLayer.selectedFeatures;
var bounds = fts[0].geometry.getBounds().clone();
for(var i=1;i<fts.length;i++)
bounds.extend(fts[i].geometry.getBounds());
mapa.zoomToExtent(bounds,false);
var

}},
});


And another store in json structure that come from jsp:


Ext.define('User',{
extend: 'Ext.data.Model',
fields:[
{name : 'ref_cad',type : 'int'},
{name : 'any2012',type : 'int'},
{name : 'any2013',type : 'int'},
{name : 'any2014',type : 'int'}
]
});

var jsonstore = Ext.create('Ext.data.Store', {
model: 'User',
proxy : {
type : 'ajax',
url : 'jsp/consulta2.jsp?',
reader : {
type : 'json',
root : 'root'
}
},
autoLoad : true
});


My wish is when I click a row, catch the ref_cad of the grid and compare to equal ref_cad to my other store, then catch they any2012, any2013 and any2014, for in the future, create a chart with this 3 records.

How can I do this? Can somebody help me please showing some basic instructions?
Many many thanks and sorry for my bad english.

Health!

Gary Schlosberg
20 Nov 2015, 2:26 PM
The itemclick (http://docs.sencha.com/extjs/4.2.5/#!/api/Ext.grid.Panel-event-itemclick) event you are using has arguments, which you should be able to use to get the row's data.