EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: fen9ye on June 08, 2014, 10:27:28 PM



Title: cannot addRow when using formatter in edatagrid mode
Post by: fen9ye on June 08, 2014, 10:27:28 PM
here is my code:
<th field="deptID" width="50" align="center"
   editor="{
      type:'validatebox',
      options:{
         required:true,
         formatter:function(value,row,index){
            var deptIDStr = value.toString();
            while(deptIDStr.length<3){
               deptIDStr = '0'+deptIDStr;
            }
            return deptIDStr;
         }
      }
   }">deptID</th>
   deptID is the idField,when I press the add Button,it doesn't work.

when I remove the formatter code,it works well.Please give me some hints


Title: Re: cannot addRow when using formatter in edatagrid mode
Post by: stworthy on June 09, 2014, 12:51:28 AM
The 'validatebox' editor has no 'formatter' option. Please check your code carefully and correct it.


Title: Re: cannot addRow when using formatter in edatagrid mode
Post by: fen9ye on June 09, 2014, 09:15:13 PM
after checking mycode,I find my formatter function wrong because lacking
if(value==null){
 return ;
}
I'm so sorry for my careless.
I still have a question:How can I get a feedback after adding row in edatagrid mode?Can you give me a demo or some hints?


Title: Re: cannot addRow when using formatter in edatagrid mode
Post by: stworthy on June 10, 2014, 02:17:00 AM
When added a new row, the 'onAdd' event fires. For more information please visit the edatagrid documentation http://www.jeasyui.com/extension/edatagrid.php.