easyUI datagrid 代码:
<table id="tabgrid20170726191838251403" class="easyui-datagrid" params="fit:true,border:false,selectOnCheck:true,remoteSort:false, url:'http://localhost:8090/gzdbthreeweb/engine/loadQueryData.pt?_queryid=20170726191838251403&dataid=20170726191919776397&gridtype=1', rownumbers:true,pagination:true,pageNumber:1,pageSize:10,checkOnSelect:true,checkOnSelect:true,onClickRow:onClickRow20170726191838251403, toolbar:'#tb20170726191838251403'"> <thead> <tr> <th params="field:'_checkid',checkbox:true" rowspan="1"></th> <th rowspan="1" colspan="1" params="align:'left',field:'report_task',sortable:true" width="442px">具体任务</th> <th rowspan="1" colspan="1" params="align:'left',field:'main_dept_name',sortable:true" width="347px">主办单位</th> <th rowspan="1" colspan="1" params="align:'left',field:'assist_dept_name',sortable:true" width="332px">协办单位</th> </tr> </thead> </table> <a href="#" class="zxui-linkbutton" plain="true" id="button495769" iconCls="null" onclick="onClickbutton495769();" >结束上报</a>
获取选中行的id,并拼接弹出:
function onClickbutton495769(){ var rows = $('#tabgrid20170726191838251403').datagrid('getSelections'); if(rows != null){ var ids = ""; for(var i=0;i<rows.length;i++){ ids+= rows[i].id+","; } alert(ids); } }
点击具体任务实现跳转:
function onClickRow20170726191838251403(rowindex, rowdata){ var row = $('#tabgrid20170726191838251403').datagrid('getSelected'); if(row != null){ var report_id = row.id; alert(report_id); window.location.href="http://localhost:8090/gzdbthreeweb/engine/page_init.pt?_queryid=20170726205804017541&report_id="+report_id; } }