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.

Was it helpful?

Solution

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

This works for me. Hope it helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top