2011-10-25 22 views
1

我有一個對象:ExtJS4網格:顯示對象在我的JSON結構

[{ id: 1, name: xxxxx, operation1: { startdate: 2011-10-25, enddate: 2011-11-25 }, operation2:{......}}] 

,以顯示操作日期,我需要訪問stardate和結束日期,但如何?

我試圖

{header:'operation1', xtype:'templatecolumn', tpl:'<span>{operation1.startdate}</span>', align:'center'} 
其實

,我動態創建列:

for(var i=1;i<=31;i++){ 
    this.columns.push({header:i, xtype:'templatecolumn', tpl:'<span>{operation'+i+'.startdate}</span>', align:'center'}); 
} 
+0

Typo? 'tpl:' {'+ i +'。startdate}''yield'tpl:' {1.startdate}'','tpl:' {2.startdate}''...等等 –

+0

對不起,這是一個錯誤:'tpl:' {operation'+ i +'。startdate}'' –

+0

問題解決了嗎?你能分享一點點,所以我們知道它有什麼問題:)乾杯! –

回答

2

最大的可能是你忘了添加operation1進入你的領域。退房this working demo

fields: ['id', 'name', 'operation1', 'operation2'] 
+0

我創建列動態創建「日曆」,檢查它上面。 –