网格:selectedIndex -1 [英] Grid: selectedIndex -1

查看:83
本文介绍了网格:selectedIndex -1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我参考了 http:// dojotoolkit发布的代码。 org / reference-guide / 1.8 / dojox / grid / DataGrid.html#working-with-selections [ ^ ],然后点击包含>的网格行。 100条记录,onRowClick =GetItemFromGrid(this)触发(在DataGrid blick中,selectionMode =single)。在调试函数GetItemFromGrid(e){...}时,我可以检索到

e.rowCount 153

但是e.selection.selectedIndex为-1,表示未选择任何内容。如何在单击时调试它以获取行?谢谢。

I referred to the code posted at http://dojotoolkit.org/reference-guide/1.8/dojox/grid/DataGrid.html#working-with-selections[^], and clicked a row of the grid that contains > 100 records, the onRowClick="GetItemFromGrid(this) fires (in the DataGrid blick, selectionMode="single"). In debugging on function "GetItemFromGrid(e) { ... }, I can retrieve that
e.rowCount 153
However the e.selection.selectedIndex is -1, which means nothing is selected. How can debug it to get the row when it is clicked on? Thanks.

推荐答案

我相信.SelectedIndex是一个ASP.NET属性,因为你正在使用Dojo API,所以它不起作用。



您可以尝试使用在这些文档中指定的代码来获取selectedItem。



I believe .SelectedIndex is an ASP.NET property which won't work, since you're working with the Dojo API.

You can try using this code, that was specified inside those documents, to get the selectedItem.

yourGrid.selection.getSelected();





这将返回selectedItems的数组,然后您可以使用自己的技术将它们传递给服务器,这可能包括将它们解析为JSON字符串或其他类似的东西。



This would return an array of the selectedItems, you can then pass them to the server using your own techniques, that might include parsing them to a JSON string or other stuff like that.


这篇关于网格:selectedIndex -1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆