Question

I have a Dojo EnhancedGrid. Suppose in one column I want to display the employee's name as a link, and aart of the URL contains must employee ID.

The row in the grid:

structure:[
  {name:"Name", field:"name", datatype:"string", formatter:createLink},
...

The formatter:

var createLink = new function(name){
  return "<a href=\"/somepage.php?id=" + employeeID + "\">" + name + "</a>";
}

How do I get the value of employeeID in the formatter?

Completely different approaches very welcome as well!

p.s. if it's relevant, the grid is using an ObjectStore wrapping an instance of JsonRest.

Était-ce utile?

La solution

function formatter(value, idx) {
    var gridRow = theGrid.getItem(idx);
    //gridRow["property"]; //some property from the store
}

This works for me. Hope it helps.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top