PDA

View Full Version : Grid column of total at the beginning



francois.thareau
15 Jul 2010, 5:22 AM
I have created column with a total function, this coulmn worked with condition :
tableau.financement.columns.push({
header: '<span class="span_bold">Taux<br/>prévisionnel</span>',
tooltip: 'Taux prévisionnel',
menuDisabled: true,
width: 120,
dataIndex: 'taux_prev_total',
renderer: function(v, params, record, rowIndex, columnIndex){
var res = 0;
var tmp;
var sub;
for (var i = 0; i < tableau.financement.correspondance.length; i = i + 1) {
tmp = tableau.financement.correspondance[i];
sub = eval('record.data.montant_eligible_previsionnel_' + tmp) * eval('record.data.taux_financeur_previsionnel_' + tmp);

res += sub;
}

return '<span class="span_bold">' + arrondir(tableau.etp.cout_prev[record.data.id] / res) + ' </span>';

}
});

the condition is i must add this column at the end of my table of column (the push), my problem is i want this column at the beginning :

i tried : tableau.financement.columns.splice(5,0,{}); but i have an error :
this.ds.fields.get(i) is undefined
ext-all-debug.js:
44506 name : (!Ext.isDefined(name) ? this.ds.fields.get(i).name : name),

i need your help for this error, any ideas ?