EasyUI Forum

General Category => Bug Report => Topic started by: aswzen on March 11, 2015, 05:41:49 AM



Title: Datagrid formatter value is not defined
Post by: aswzen on March 11, 2015, 05:41:49 AM
On easyui 1.4.1 my column formatter runs well, but after upgraded to 1.4.2 some of my formatter showing error about "value is undefined".

i saw on documentation that formatter function will pass and return 3 params
Quote
The cell formatter function, take three parameters:
value: the field value.
rowData: the row record data.
rowIndex: the row index.
formatter: function(value,row,index)

but when i try to manipulate the value before it showed on datagrid, the browser says "value is undefined"
why this is happened?  ???
even the console.log will display "undefined"  :-\

this is the manipulate formatter
Code:
function formatMe(valuee, row, index){
    console.log(valuee);
    var j = valuee.split(' - ');
    var je = j[0];
    return je;
}

here the fiddle
http://jsfiddle.net/aswzen/jbhr492r/1/
 (http://jsfiddle.net/aswzen/jbhr492r/1/)

thanks in advance


Title: Re: Datagrid formatter value is not defined
Post by: jarry on March 11, 2015, 07:43:40 AM
Before calling the 'split' function you must determine if the 'valuee' is undefined. Please try this:
Code:
function formatMe(valuee, row, index){
    var j = (valuee||'').split(' - ');
    var je = j[0];
    return je;
}
http://jsfiddle.net/jbhr492r/2/


Title: Re: Datagrid formatter value is not defined
Post by: aswzen on March 11, 2015, 06:49:31 PM
ow thank you..  :)

so different with older version