EasyUI Forum
May 18, 2024, 12:07:11 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Datagrid formatter value is not defined  (Read 10491 times)
aswzen
Sr. Member
****
Posts: 287


Indonesian

aswzen
View Profile WWW Email
« 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?  Huh
even the console.log will display "undefined"  Undecided

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/


thanks in advance
« Last Edit: March 11, 2015, 05:43:43 AM by aswzen » Logged

Regards,
Sigit

- Indonesian jEasyUI Facebook page : https://www.facebook.com/groups/jeasyuiid/
jarry
Administrator
Hero Member
*****
Posts: 2264


View Profile Email
« Reply #1 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/
Logged
aswzen
Sr. Member
****
Posts: 287


Indonesian

aswzen
View Profile WWW Email
« Reply #2 on: March 11, 2015, 06:49:31 PM »

ow thank you..  Smiley

so different with older version
Logged

Regards,
Sigit

- Indonesian jEasyUI Facebook page : https://www.facebook.com/groups/jeasyuiid/
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!