-1
我試圖將數據從該格式轉換:如何構建這個數組
data.addRows([
[new Date(2011, 1, 23), , '<div>Conversation</div><img src="img/comments-icon.png" style="width:32px; height:32px;">', '', ''],
[new Date(2011, 1, 23, 23, 0, 0), , '<div>Mail from boss</div><img src="img/mail-icon.png" style="width:32px; height:32px;">', '', ''],
[new Date(2011, 1, 24, 16, 0, 0), , 'Report', '', ''],
[new Date(2011, 1, 26), new Date(2011, 2, 2), 'Traject A', '', ''],
[new Date(2011, 1, 27), , '<div>Memo</div><img src="img/notes-edit-icon.png" style="width:48px; height:48px;">', '', ''],
[new Date(2011, 1, 29), , '<div>Phone call</div><img src="img/Hardware-Mobile-Phone-icon.png" style="width:32px; height:32px;">', '', ''],
[new Date(2011, 1, 28), new Date(2011, 2, 3), 'Traject B', '', ''],
[new Date(2011, 2, 4, 4, 0, 0), , '<div>Report</div><img src="img/attachment-icon.png" style="width:32px; height:32px;">', 'http://images.clipartpanda.com/test-clip-art-cpa-school-test.png', 'test2']
]);
到:
data.addRows(dataNew);
什麼是創建這個數組中的JavaScript的最好方法:
[
[new Date(2011, 1, 23), , '<div>Conversation</div><img src="img/comments-icon.png" style="width:32px; height:32px;">', '', ''],
[new Date(2011, 1, 23, 23, 0, 0), , '<div>Mail from boss</div><img src="img/mail-icon.png" style="width:32px; height:32px;">', '', ''],
[new Date(2011, 1, 24, 16, 0, 0), , 'Report', '', ''],
[new Date(2011, 1, 26), new Date(2011, 2, 2), 'Traject A', '', ''],
[new Date(2011, 1, 27), , '<div>Memo</div><img src="img/notes-edit-icon.png" style="width:48px; height:48px;">', '', ''],
[new Date(2011, 1, 29), , '<div>Phone call</div><img src="img/Hardware-Mobile-Phone-icon.png" style="width:32px; height:32px;">', '', ''],
[new Date(2011, 1, 28), new Date(2011, 2, 3), 'Traject B', '', ''],
[new Date(2011, 2, 4, 4, 0, 0), , '<div>Report</div><img src="img/attachment-icon.png" style="width:32px; height:32px;">', 'http://images.clipartpanda.com/test-clip-art-cpa-school-test.png', 'test2']
]