EasyUI Forum
May 04, 2024, 09:55:46 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: Formatter Column Property From PHP Json Encode  (Read 6992 times)
arma
Full Member
***
Posts: 110


View Profile
« on: March 11, 2015, 05:15:58 AM »

How can i use formatter property value without string quote from PHP json_encode() ?

I have this:
Code:
['field' => 'total_amount', 'formatter' => 'formatAmount', 'title' => 'Month X', 'width' => 150]

after encoded :
Code:
{'field' : 'total_amount', 'formatter' : 'formatAmount', 'title' : 'Month X', 'width' : 150}

What i want is 'formatter' : formatAmount (without quote) otherwise will throw js error :  Uncaught TypeError: string is not a function

Thank you
Logged
arma
Full Member
***
Posts: 110


View Profile
« Reply #1 on: March 13, 2015, 01:57:12 AM »

Does Jeasui support formatter in string ?
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #2 on: March 13, 2015, 09:31:42 AM »

The 'formatter' is a function. You must convert it to a function before using it.
Code:
var column = {'field' : 'total_amount', 'formatter' : 'formatAmount', 'title' : 'Month X', 'width' : 150};
var f = column['formatter'];
if (f){
column['formatter'] = eval(f);
}
Logged
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!