EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: aswzen on March 28, 2017, 11:22:38 PM



Title: How to get column name in formatter?
Post by: aswzen on March 28, 2017, 11:22:38 PM
How to get column name in formatter?
Code:
function formatContent(value,row,index){
        data = columnName.split('-');
if(data[1] != undefined){
return 'OK';
} else {
return 'NOT OK';
}
}

Thank you in advance


Title: Re: How to get column name in formatter?
Post by: aswzen on January 18, 2018, 09:53:26 AM
Hello stworthy,

Is this possible to get colum name while formatting its column?

Thank you


Title: Re: How to get column name in formatter?
Post by: aswzen on January 18, 2018, 10:44:00 AM
never mind

Code:
function formatContent(value,row,index){
    var col = "";
    for(var name in row){
        col = "";
        var value = row[name];
        if(value === val){
            col = name;
            break;
        }
    }
    return col;
}


Title: Re: How to get column name in formatter?
Post by: shumakosik on January 19, 2018, 04:56:26 AM
It's simple:
You can get field in Formatter:

function formatContent(value,row,index){
  return this.field;
}


Title: Re: How to get column name in formatter?
Post by: aswzen on May 13, 2018, 09:55:33 PM
should be on documentation