Dear All,
I don't reach to populate my Tree-Grid with data from my solr server.
I reach to get json data but nothing in my Tree-Grid.
I use MVC structure.
My store is defined in my tree-grid definition.
I don't know why it doesn't work :'(
If I comment the reader inside my store i haven't error message, and:
console.log(this.proxy.reader.rawData.response.docs);
answers a good json.
If I uncomment the reader, i have this error !
TypeError: obj.response is undefined
|
return Function.prototype.constructor.apply(Function.prototype, args); |
it seems that this line is not ok:
root: 'response.docs'
Could you help me please to find the problem ?
Thanks a lot !
Below my other codes
My Store:
Code:
Ext.define('MPortal.store.patent.Patents', {
extend: 'Ext.data.TreeStore',
model: 'MPortal.model.patent.Patent',
proxy: {
type: 'jsonp',
url: 'http://www.my_solr_server.com/solr/select/',
callbackKey: 'json.wrf',
limitParam: 'rows',
extraParams: {
wt: 'json',
'json.nl': 'arrarr',
fl: 'pn,fid,pd',
rows: '10'
},
reader: {
type: 'json',
root: 'response.docs'
}
}
});
My Model
Code:
Ext.define('MPortal.model.patent.Patent', {
extend: 'Ext.data.Model',
fields: [
{name: 'pn', type: 'string'},
{name: 'fid', type: 'string'},
{name: 'pd', type: 'date'}
]
});
My tree-grid
Code:
Ext.define('MPortal.view.patent.MyPatentTreeGrid', {
extend: 'Ext.tree.Panel',
alias: 'widget.mypatenttreegrid',
requires: [
'Ext.data.*',
'Ext.grid.*',
'Ext.tree.*',
'Ext.ux.CheckColumn',
'MPortal.model.patent.Patent'
],
xtype: 'tree-grid',
useArrows: true,
rootVisible: false,
multiSelect: true,
singleExpand: true,
initComponent: function() {
Ext.apply(this, {
store: 'MPortal.store.patent.Patents',
columns: [
{
//xtype: 'treecolumn', //this is so we know which column will show the tree
text: 'Patent Number',
flex: 2,
dataIndex: 'pn',
sortable: true
},{
text: 'Family Id',
flex: 1,
dataIndex: 'fid',
sortable: true
},{
text: 'Pud. Date',
flex: 1,
dataIndex: 'pd',
sortable: true
}
]
});
this.callParent();
}
});
and now, the method I use to call it:
Code:
.....
var mySearches = this.getTreePanel().getStore();
mySearches.load({
params: { q: mySolrQuery.value },
callback: function(response) {
console.log("we searched");
console.log(this.proxy.reader.rawData.response.docs);
//console.log(response);
//var json = Ext.decode(this.proxy.reader.rawData.response.docs);
//console.log(json[0].pn);
}
});
...