Я очень новичок в extjs, я поражен слышать об одном дне, пожалуйста, любой помогите.
Как получить вложенные данные json на уровне столбцов в extjs
Для обычных столбцов он получился точно, но когда он кончил в массив, столбец на col6 был поражен.
вот так выглядит моя модель
Данные JSON, такие как:
[
{
"col1" : "abc",
"col2" : "aasd",
"col3" : "aasd",
"col4" : "sad",
"col5" : "sad",
"col6" : [
{
"inncol1": "laksd",
"inncol2": "laksd"
},
{
"inncol1": "laksd",
"inncol2": "laksd"
}
]
},
{
"col1" : "abc",
"col2" : "aasd",
"col3" : "aasd",
"col4" : "sad",
"col5" : "sad",
"col6" : [
{
"inncol1": "laksd",
"inncol2": "laksd"
},
{
"inncol1": "laksd",
"inncol2": "laksd"
}
]
}
]
Ожидается выход:
====================================================================
**col1** **col2** **col3** **col4** **col5** **col6 **
========================
**inncol1** **inncol2**
====================================================================
abc jasd asjd aasd asdjk asdjk asdas
asdas asdd
=====================================================================
asdas sada asdas sdf asdas asdas sdaas
asds daass
======================================================================
Модель:
Ext.define('MONTHWISEMODEL',
{
extend : 'Ext.data.Model',
fields :
[
{ name: 'col1' }
,{ name: 'col2' }
,{ name: 'col3' }
,{ name: 'col4' }
,{ name: 'col5' }
,{ name: 'col6' }
]
});
Магазин это:
getStore : function()
{
var proxy = {
type : 'ajax'
,url : myurl
,reader : 'jsonreader'
return Ext.create('Ext.data.GridStore',
{
model : 'MONTHWISEMODEL'
,autoLoad : false
,autoDestroy: false
,proxy : proxy
});
}
}
Сетка:
getMonthlyReportGrid : function()
{
var me = this;
var store = me.getStore();
var reportsGrid = Ext.create('Ext.custom.grid.Panel',
{
store : store
,id : 'monthlyGridData'
,overflowX : 'scroll'
,overflowY : 'scroll'
,forceFit : false
,height : 450
,cls : 'pr-data-grid'
,columns :
[
{ text : 'col1' ,dataIndex : 'col1' }
,{ text : 'col2' ,dataIndex : 'col2' }
,{ text : 'col3' ,dataIndex : 'col3' }
,{ text : 'col4' ,dataIndex : 'col4' }
,{ text : 'col5' ,dataIndex : 'col5' }
,{ text : 'col6' , columns: [
,{ text : 'inncol1' ,dataIndex : 'inncol1' }
,{ text : 'inncol2' ,dataIndex : 'inncol2' }
] }
]
});
return reportsGrid;
}