【问题标题】:Dojo grid: accessing another attribute from a formatterDojo 网格:从格式化程序访问另一个属性
【发布时间】:2013-10-21 04:52:05
【问题描述】:

我有一个 Dojo EnhancedGrid。假设我想在一列中显示员工姓名作为链接,并且 URL 的艺术部分必须包含员工 ID。

网格中的行:

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

格式化程序:

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

如何在格式化程序中获取employeeID 的值?

也非常欢迎完全不同的方法!

附言如果相关,则网格正在使用包装 JsonRest 实例的 ObjectStore。

【问题讨论】:

    标签: javascript dojo dojox.grid


    【解决方案1】:
    function formatter(value, idx) {
        var gridRow = theGrid.getItem(idx);
        //gridRow["property"]; //some property from the store
    }
    

    这对我有用。希望能帮助到你。

    【讨论】:

      猜你喜欢
      • 2021-11-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-11-13
      • 1970-01-01
      • 2017-10-17
      相关资源
      最近更新 更多