javascript - 道场网格 : naviagion

标签 javascript dojo dojox.grid

我正在探索 dojo 网格,找不到一个很好的例子来说明如何通过单击行来处理导航。

有一个简单的网格示例here

如何根据以下需求扩展代码

  1. 处理行项目上的双击事件
  2. 读取标识符并提取与所选行对应的值(第一行为 12)
  3. 重定向到{current domain}/view/{identifier}(比如www.example.com/view/12)

任何帮助都会节省很多时间...

谢谢。

编辑:添加了 javascript 标签,以便更多用户可以看到这篇文章(目前只有 9 个只有 dojo)

最佳答案

我必须解决上面的问题 1 和 2。 您可以使用 dojo.connect 将网格连接到 onRowClick 事件。例如,如果您有以下形式的网格:

        <div dojoType="dojox.grid.DataGrid" jsId="grid" id="myGrid" structure="layout" selectionMode="single"></div>

然后您可以在 JavaScript 中调用:

dojo.connect(grid, "onRowClick", clickMethod);

clickMethod 然后可以访问行中的数据,如下所示:

function clickMethod(event) {
...
selected_index = grid.focus.rowIndex;
selected_item = grid.getItem(selectedIndex);
//Not sure if this is the most efficient way but it worked for me
selected_id = grid.store.getValue(selectedItem, "field_name_from_store");
...
}

我想你可以在那之后做一个 location.href 或类似的东西。

关于javascript - 道场网格 : naviagion,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5084161/

相关文章:

javascript - Dojo - 调用排序后行从 DataGrid 中消失

javascript - 需要在 dijit.form.DateTextBox 中设置语言

javascript - 道场网格: accessing another attribute from a formatter

javascript - 这个函数的目的是什么?

javascript - 找不到包裹在匿名函数中的递归函数调用

javascript - HtmlPage.Window.Navigate 在调试中有效,但在部署时无效

javascript - 使用 dojo 工具包按间隔将 majorTicksColor 转换为 dojox 仪表

javascript - react : JSON Tree with the help of Recursion

即使在 DataGrid 的空白区域中右键单击,Dojo DataGrid 上下文菜单 onRowContextMenu 也会显示

javascript - 网格中的更新值未显示在 java spring Controller 中