EasyUI DataGrid Checkbox 多选 获取选中行中的内容

系统管理员 2021-09-29 11:56 504阅读 0赞
  1.     <table id='grid' class='easyui-datagrid' style='width:950px;height:405px'
  2.               url='Ajax-index.php?module=<{$module_name}>&action=Ajax_GridView_Select&assigned_user_id=<{$assigned_user_id}>'
  3.      title='列表' iconCls='icon-table' pagination='true' rownumbers='true' toolbar='#toolbar'
  4.               fitColumns='false' singleSelect='false' >
  5. <thead>
  6. <tr>
  7. <!-- <th field='select' width='30' align='center'></th> -->
  8. <th field='id' width='10' hidden='true'>编号</th>
  9. <th data-options="field:'ck',checkbox:true"></th>
  10. <th field='name' width='130'align='center'>名称</th>
  11. <th field='date_entered' width='130'align='center'>创建时间</th>
  12. <th field='description' width='150' align='center'>描述</th>
  13. <th field='assigned_user_name' width='130' align='center'>负责人</th>
  14. </tr>
  15. </thead>
  16. </table>
  17.     <div id='toolbar'>
  18.    <a href='#' class='easyui-linkbutton' iconCls='icon-add' plain='true' onclick='GetChecked()'>收款</a>
  19.    <a href='#' class='easyui-linkbutton' iconCls='icon-cancel' plain='true' onclick='parent.TabClose();'>关闭</a>
  20. </div>
  21. <script type='text/javascript'>
  22. //单选 事件
  23. $('#grid').datagrid({
  24. onCheck: function(index, data) {
  25. //alert(data[0]);alert(data[1]);alert(data[2]);
  26. //alert(index );
  27. }
  28. });
  29. //获取选中的行内容
  30. function GetChecked(){
  31. var checkedItems = $('#grid').datagrid('getChecked');
  32. var names = [];
  33. $.each(checkedItems, function(index, item){
  34. names.push(item.name);
  35. });
  36. alert(names.join(","));
  37. //console.log(names.join(","));
  38. }
  39. </script>

  

  

转载于:https://www.cnblogs.com/hailexuexi/p/8435017.html

发表评论

表情:
评论列表 (有 0 条评论,504人围观)

还没有评论,来说两句吧...

相关阅读