Im cercando di ciclo un array con extjs xtemplate e creare una tabellaCome ciclo all'interno extjs XTemplate
Ext.define('dataview_model', {
extend : 'Ext.data.Model',
fields : [
{name: 'count', type: 'string'},
{name: 'maxcolumns', type: 'string'},
{name: 'maxrows', type: 'string'},
{name: 'numbers', type: 'array'}
]
});
Ext.create('Ext.data.Store', {
storeId : 'viewStore',
model : 'dataview_model',
data : [
{count: '7', maxcolumns: '10', maxrows: '5', numbers: ['100','200','300','400','500','600','700']}
]
});
var tpl = new Ext.XTemplate(
'<tpl for=".">',
'<tpl if="count > 0">',
'<table class="view_table">',
'<tpl for="numbers">',
'<tr>',
'<td>{.}</td>',
'</tr>',
'</tpl>',
'</table>',
'</tpl>',
'</tpl>'
);
Ext.create('Ext.DataView', {
width : 500,
height : 200,
renderTo : Ext.getBody(),
store : Ext.getStore('viewStore'),
tpl : tpl
});
questo è l'esempio di lavoro che ho finora
quello che vuoi fare è fermare il ciclo una volta che ci sono 5 righe e aggiungere altri valori alla seconda colonna come sotto
+----+ +----+
| | | |
+----+ +----+
+----+ +----+
| | | |
+----+ +----+
+----+
| |
+----+
+----+
| |
+----+
+----+
| |
+----+
qualche idea su come fare questo?
Grazie.
grazie. Aiuta molto –