Tutorial :JQuery Flexigrid question



Question:

Anyone know how to format the columns on a flexigrid?

http://turbogears.org/2.0/docs/main/ToscaWidgets/Cookbook/FlexiGrid.html

the colModel doesn't seen to have any formatting params

I want to do simple things like format my date col with "{0:dd MMM yyyy}"


Solution:1

Set the process property of the column you want to format, like this:

colModel: [                  {display: "ID", name: "id", width: 40, sortable: true, align: "center", process: procMe},                  {display: "Title", name: "title", width: 180, sortable: true, align: "left"}                ],  

notice the process: procMe on the first col, and then:

function procMe(celDiv,id) {      $(celDiv).html("Some formated text/icons/pics or whatever here");  };   

I don't have a way to try it right now but i think it should work, sorry if there are any mistakes i just wrote it from memory and i might have forgotten something.

Hope it helps...


Solution:2

I don't think flexigrid includes formatting properties.

Can't you format the date when you are fetching the data from the server?


Solution:3

I agree with ToRrEs - format your data before you serialize it. This way you push down just what you need to the client.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »