Opened 13 years ago

Closed 13 years ago

#9316 closed enhancement (invalid)

Include a new parameter in grid formatter

Reported by: vincentastek Owned by: Bryan Forbes
Priority: low Milestone: tbd
Component: DojoX Grid Version: 1.3.1
Keywords: grid formatter function arguments parameter Cc: Nathan Toone, [email protected]
Blocked By: Blocking:



For my need, I would like to be able to know, in my grid formatter, which field is treated. Because in my grids, I may have many different date patterns for many different fields, and the actual arguments of the formatter function don't let me know which one is treated.

So my request is to add a parameter like "field" (which will contain field identifier for example) to the current :

formatter:function(data, rowIndex)


So if I have a layout like :

var gridLayout = [{ field: "id", name: "Identifiant", width: '100px', cellStyles:"text-align: right;" },{ field: "nom", name: "Nom"},{ field: "birthDate", name: "Date de naissance"},{ field: "deathDate", name: "Date de décès"}];

I would be able to use the formatter to format birthDate and deathDate using different date patterns (using double entry array for example).

Thanks a lot,


Change History (5)

comment:1 Changed 13 years ago by Adam Peller

there's a 'constraints' object. Can you pass the values you need as properties on constraints?

comment:2 Changed 13 years ago by vincentastek

I don't understand, sorry. Can this constraints object help me to know exactly in which column is the cell i'm formatting , when in the formatter function ?

comment:3 Changed 13 years ago by Adam Peller

no, but you can attach any information to it when defining your grid for a particular column, such as number formats. I suppose if you wrote a custom formatter routine, you could use any field you define.

comment:4 Changed 13 years ago by vincentastek

Do you have a source or an example of use of this column related constraints object ? I didn't find any information in the documentation or the source...

Sorry to be so lame ...

comment:5 Changed 13 years ago by Adam Peller

Cc: Nathan Toone added
Resolution: invalid
Status: newclosed

No, the grid documentation is known to be lacking. Take a look in dojox/grid/tests/test_edit_dijit.html for "Custom formatters" I had to look pretty hard for it myself.

Note: See TracTickets for help on using tickets.