Change the display format

QuestionsChange the display format
Kelvin asked 10 years ago

Dear Sir/Madam,

I purchased the license and would like to know how I can change the display format in cell, for example the field contain the value 0.5 and I would like to display it as 50% but keeping the value as 0.5 when edit?

Best regards,

Kelvin.

3 Answers
Abu Ghufran answered 10 years ago

For custom formatter of percentage display

$col["formatter"] = "function(cellval,options,rowdata){ return cellval/100+'%'; }";
$col["unformat"] = "function(cellval,options,cell){ return cellval.replace('%','')*100; }";

Abu Ghufran answered 10 years ago

The formula would be different. Posted opposite.

$col["formatter"] = "function(cellval,options,rowdata){ return cellval*100+'%'; }";
$col["unformat"] = "function(cellval,options,cell){ return cellval.replace('%','')/100; }";

Terry answered 8 years ago

I found you can put HTML in a <textbox> and it will not render as html so I did this

$col["formatter"] = "function(cellval,options,rowdata){ return '<textarea cols="3000" rows="1">'+cellval+'</textarea>'; }";

$col["unformat"] = "function(cellval,options,cell){ return cellval; }";

I made a text box 3000×1 as my cellval field in the DB is a varchar 3000

it works great

Your Answer

9 + 10 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?