PDA

View Full Version : format.usMoney to format.number



untusoft
13 Nov 2009, 5:38 PM
Hi all,
I'm beginner in extjs.
I want to change format renderer usMoney into Number. For Example : 2000 into 2,000 display. I've already using usMoney and the result : $2,000. I just want to delete this '$' .


BKKsColumnModel = new Ext.grid.ColumnModel(
[{ header: 'No BKK', dataIndex: 'NO_BKK', width: 80, sortable: true},
{ header: 'N0 Kuitansi',dataIndex: 'NO_KUITANSI',width: 50,sortable: true},
{ header: 'Tgl', dataIndex: 'TGL',width: 100,sortable: true },
{ header: 'Uraian', dataIndex: 'URAIAN',width: 200,sortable: true},
{ header: 'Jumlah', dataIndex: 'JUMLAH',width: 90, sortable: true, summaryType: 'sum', align : 'right',
renderer: Ext.util.Format.usMoney}
..........


I've tried to change it into :
Ext.util.Format.number()


but always error...
Is there something wrong...
Thanks for any advice...

untusoft
13 Nov 2009, 7:34 PM
I've found it. It's easy, feiuh......
I just have to create a function :


function change(val){
return Ext.util.Format.number(val, '?0,000.00?');
}

and then point renderer into : change



......
{ header: 'Jumlah', dataIndex: 'JUMLAH',width: 90, sortable: true, summaryType: 'sum', align : 'right', renderer: change },
......


Thanks...