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.

有帮助吗?

解决方案

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

This works for me. Hope it helps.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top