转自:http://www.jeasyui.net/tutorial/23.html

本实例演示如何取得选中行数据。

数据网格(datagrid)组件包含两种方法来检索选中行数据:

  • getSelected:取得第一个选中行数据,如果没有选中行,则返回 null,否则返回记录。
  • getSelections:取得所有选中行数据,返回元素记录的数组数据。

创建数据网格(DataGrid)

  1. <table id="tt" class="easyui-datagrid" style="width:600px;height:250px"
  2. url="data/datagrid_data.json"
  3. title="Load Data" iconCls="icon-save">
  4. <thead>
  5. <tr>
  6. <th field="itemid" width="80">Item ID</th>
  7. <th field="productid" width="80">Product ID</th>
  8. <th field="listprice" width="80" align="right">List Price</th>
  9. <th field="unitcost" width="80" align="right">Unit Cost</th>
  10. <th field="attr1" width="150">Attribute</th>
  11. <th field="status" width="60" align="center">Stauts</th>
  12. </tr>
  13. </thead>
  14. </table>

使用演示

取得选中行数据:

  1. var row = $('#tt').datagrid('getSelected');
  2. if (row){
  3. alert('Item ID:'+row.itemid+"
  4. Price:"+row.listprice);
  5. }

取得所有选中行的 itemid:

  1. var ids = [];
  2. var rows = $('#tt').datagrid('getSelections');
  3. for(var i=0; i<rows.length; i++){
  4. ids.push(rows[i].itemid);
  5. }
  6. alert(ids.join('
  7. '));

EasyUI 取得选中行数据的更多相关文章

  1. 在EasyUI中统一判断是否有选中行,如果有则将选中行数据传入回调函数

    function procossWithSeletedData(func) { var rowData = $("#tbGrid").datagrid("getSelec ...

  2. easyui datagrid 选中行效果

    转:http://blog.csdn.net/hzw2312/article/details/27534065 jquery easyui datagrid 获取Checked选择行(勾选行)数据 g ...

  3. jQuery DataTables 获取选中行数据

    如题 想获取操作 DataTables 获取选中行数据 案1.主要是利用 js  getElementsByTagName 函数 然后对获取到的tr 进行操作  如下 function getChec ...

  4. jquery easyui datagrid 在翻页以后仍能记录被选中的行及刷新设置选中行数据

    //easyUI的datagrid在复选框多选时,如何在翻页以后仍能记录被选中的行://注意datagrid中需要配置idField属性,一般为数据的主键 $.ajax({ type: 'GET', ...

  5. JqGrid获得所有选中行数据ID数组,获取所有行的ID数组

    获得选中行的ID数组:var ids = $("jqgridtableid").jqGrid('getGridParam','selarrrow'); 获得所有行的ID数组:var ...

  6. easyui获取选中行上一行的数据

    text: 'XX',            iconCls: 'icon-ok',            handler: function () {                var rowI ...

  7. Table获取checkbox选中行数据

    //检测勾选值 function checkEnter() { var Ivalue = ""; $("#dataTable tr").each(functio ...

  8. Ext.net获取选中行数据

    两种方法 1.直接返回对象列表 <DirectEvents> <Click> <ExtraParams> <ext:Prameter Name="V ...

  9. 【Winform-获取ListView选中行】Winform如何获取ListView选中行数据 ?

    =========这是Winform================== 1.设计窗体 一个ListView    listView1 一个textBox    txbSelected 2.listV ...

随机推荐

  1. 基于vue实现模糊匹配(这里以邮箱模糊匹配为例,其他的模糊匹配都可以类比)

    html部分(主要部分): js: data: methods: 效果图:

  2. BNUOJ 35759 The Great Pan

    The Great Pan Time Limit: 1000ms Memory Limit: 65536KB This problem will be judged on HDU. Original ...

  3. navicat mysql 连接本地 忘记密码 查看密码 操作

    https://jingyan.baidu.com/article/454316ab4e9e65f7a7c03ad1.html

  4. poj - 2195 Going Home (费用流 || 最佳匹配)

    http://poj.org/problem?id=2195 对km算法不理解,模板用的也不好. 下面是大神的解释. KM算法的要点是在相等子图中寻找完备匹配,其正确性的基石是:任何一个匹配的权值之和 ...

  5. Critical Links-UVa796(无向图求桥)

    https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...

  6. P1765 手机_NOI导刊2010普及(10)

    P1765 手机_NOI导刊2010普及(10) 题目描述 一般的手机的键盘是这样的: 1 2 abc 3 def 4 ghi 5 jkl 6 mno 7 pqrs 8 tuv 9 wxyz * 0 ...

  7. 洛谷 P1883 函数

    P1883 函数 题目描述 给定n个二次函数f1(x),f2(x),...,fn(x)(均形如ax^2+bx+c),设F(x)=max{f1(x),f2(x),...,fn(x)},求F(x)在区间[ ...

  8. PLSQL Developer来实现不同数据库的表结构以及表数据同步

    PLSQL Developer菜单条中 Tools选项下有Compare User Objects和Compare Table Data功能. 一.Tools --> compare user ...

  9. cheat sheet (小抄的意思-考试的时候,带在路上原先抄的重要的知识点)

    Cheat Sheet,这里面有个Cheat(欺骗),想当然的话,意思肯定不好.事实上,这Cheat Sheet 的原意的确也就是“小抄”的意思.所以,字典的定义是:“A piece of paper ...

  10. 魔兽争霸3 冰封王座 w3g文件如何打开

    w3g文件怎么样才能看??? 满意回答 检举|2011-11-10 11:23 你应该是玩魔兽争霸的吧,如果是就找到你魔兽安装文件夹里面有个replay的文件夹,把w3g格式的文件放入该文件夹,再进入 ...