views:

521

answers:

3

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}"

+1  A: 

I don't think flexigrid includes formatting properties.

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

ToRrEs
A: 

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

David Robbins
+1  A: 

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...

OldJim