EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: jaimi on October 12, 2016, 12:37:30 AM



Title: datagrid addrow doesn't work with defined formatter
Post by: jaimi on October 12, 2016, 12:37:30 AM
I have a field defined:
Code:
  ,{field:'HTH_MWST',title:'MWSt',width:070,sortable:'true',align:'left'
      ,editor:{ type:'numberbox'
              ,options:{ required:true
            ,prompt:'Mehrwert-Steuer...'
            ,missingMessage:'Geben Sie den Mehrwert-Steuer-Satz für die Behandlung ein.'
,precision:2
,decimalSeparator:','
,max:100
   }
  }//editor

  ,formatter: function(value, row, index){
   var val = value.replace(/\./g,",");
   return '<span>' + val.substring(0,4) + '</span>'
  }//formatter

    }//field

With formatter activated the addRow function doesn't work anymore:
Code:
 function addHeilungKosten(){
  $('#edgPferdHeilungKosten').edatagrid('addRow',0);
 }//addHeilungKosten

The datagrid does not appear with a new row.
What's wrong?


Title: Re: datagrid addrow doesn't work with defined formatter
Post by: jarry on October 13, 2016, 01:13:02 AM
Please use this 'formatter' function definition instead.
Code:
formatter: function(value, row, index){ 
     var val = (value||'').replace(/\./g,',');
     return '<span>' + val.substring(0,4) + '</span>'
}


Title: Re: datagrid addrow doesn't work with defined formatter
Post by: jaimi on October 13, 2016, 10:26:51 PM
Thx  :)