增强网格中的行选择 [英] Row Selection in Enhanced Grid

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

问题描述

我是Dojo的新手,我遇到了一个让我彻底失败的问题。我正在使用增强型网格在Dojo中创建一个数据网格。



网格中的每一行都有一个可以选择该行的复选框。该复选框已使用间接选择插件实现。



现在,当我使用复选框选择一行时,一切正常。但是当我通过点击其他数据单元格选择一行时,该行不会被选中!



属于datagrid的JSP部分

 <表数据-dojo-id =griddata-dojo-type =dojox.grid.EnhancedGridplugins ={indirectSelection:{headerSelector:true},filter:true,pagination:true}
data-dojo- propers =store:icGrid,
clientSort:trueformatterScope =myFormatters
style =width:100%; height:20em>
< thead>
< tr>
< th width =25%field =empNoformatter =formatLink> empNo< / th>
< th width =25%field =name> name< / th>
< th width =25%field =email> email< / th>
< th width =25%field =phone> phone< / th>
< / tr>
< / thead>
< / table>

如果我删除代码参考间接选择(plugins ={间接选择...)行当我点击其他数据单元格(如他们应该)时,得到选择,但是我也需要间接选择实现的复选框。



有没有办法使间接选择工作没有删除行选择功能?



查看我将在下面链接的页面中的网格,我需要一个类似于
的网格最后一个网格中的复选框)



http://dojotoolkit.org/documentation/tutorials/1.8/working_grid/demo/selector.php

解决方案

我设法解决问题1.使用cellClick事件进行侦听2.获取单击单元格的rowindex 3.将其设置为选定。

  grid.on(CellClick,f unction(event)
{
var rowId = event.rowIndex;
grid.selection.setSelected(rowId,true);
grid.render();
}

grid.selection.getSelected();没有返回所选行,我想知道这是否是兼容性问题?看起来像当我使用indirectSelection插件行Select是意想不到的行为。


I am new to Dojo and i came across a problem that has me completely stumped. I am creating a data grid in Dojo with the Enhanced Grid .

Each row in the grid has a checkbox with which the row can be selected. The checkbox has been implemented using the indirectselection plugin.

Now when i select a row using the checkbox everything works fine. But when I select a row by clicking on other data cells the row does'nt get selected !

Heres the JSP part of the datagrid

<table  data-dojo-id="grid" data-dojo-type="dojox.grid.EnhancedGrid" plugins="{indirectSelection: {headerSelector:true}, filter: true,pagination: true}"
    data-dojo-props="store:icGrid, 
     clientSort:true "  formatterScope="myFormatters" 
    style="width: 100%; height: 20em;">
     <thead>
         <tr>
      <th width="25%" field="empNo"  formatter="formatLink">empNo</th>
      <th width="25%" field="name">name</th>
      <th width="25%" field="email">email</th>
      <th width="25%" field="phone">phone</th>
    </tr>
  </thead>
</table>

If I remove the code referring to indirect selection (plugins="{indirectselection...) the rows get selected when I click on other data cells (as they should). But I also need the checkbox that the indirectselection implements.

Is there a way to make the indirectselection work without taking away the row select functionality ?

Take a look at the grid in the page I will link below. I need a grid that works like that (The last grid in the page with the checkboxes)

http://dojotoolkit.org/documentation/tutorials/1.8/working_grid/demo/selector.php

解决方案

I managed to resolve the issue by 1. using the cellClick event to listen 2. Get the rowindex of the cell when it is clicked 3. set it to selected.

grid.on("CellClick", function(event)
    { 
        var rowId = event.rowIndex;
        grid.selection.setSelected(rowId, true);
        grid.render();
          }

grid.selection.getSelected(); did not return the selected rows and I am wondering if this is a compatibility issue ? It seems like when i use the indirectSelection plugin the row Select is behaving in unexpected ways.

这篇关于增强网格中的行选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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