Skip to content

Instantly share code, notes, and snippets.

@novalagung
Created November 19, 2012 03:04
Show Gist options
  • Save novalagung/4108729 to your computer and use it in GitHub Desktop.
Save novalagung/4108729 to your computer and use it in GitHub Desktop.
Ext.override(Ext.form.TextField, {
getValue: function(){
var val = this.getRawValue();
if (this.name == 'txtBiayaLain'
|| this.name == 'txtTotalPajak'
|| this.name == 'txtTotalSetelahPajak'
|| this.name == 'txtUangMuka'
|| this.name == 'txtSaldoTerhutang') {
val = String(val).replace(',', '').split('.');
val = val[0];
}
return val;
},
setValue: function(o) {
var val = o;
if (this.name == 'txtBiayaLain'
|| this.name == 'txtTotalPajak'
|| this.name == 'txtTotalSetelahPajak'
|| this.name == 'txtUangMuka'
|| this.name == 'txtSaldoTerhutang') {
val = String(val).replace(',', '').split('.');
val = Ext.util.Format.number(parseInt(val[0]), '0,0.0');
}
Ext.form.TextField.superclass.setValue.call(this, val);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment