[_] EasyUI remember multiple choice list parameter passing (datagrid usage)

Multiple selection operation in the page list, the selected data to the control layer.

Page Display:
Here Insert Picture Description
List Code:

<table data-toggle="topjui-datagrid"
               data-options="id: 'productDg',
               fitColumns:false,remoteSort: false,pageNumber:1,
                url: ''">
            <thead>
            <tr>
                <th data-options="field:'uuid',title:'UUID',checkbox:true"></th>
                <th data-options="field:'orderID',title:'订单ID',width:220"></th>
                </tr>
            </thead>
        </table>

js:

<script>
    var selectedRow = $('#productDg').iDatagrid('getSelections');
    var taskIDS = "";
    for (var i = 0; i < selectedRow.length; i++) {
    /* 多个id 用@ 拼接成一个字符串 控制层接受后 拆分*/
        taskIDS += selectedRow[i].orderID + "<@>"
        /* console.log("ceshi002 " + taskIDS);*/
    }
    $("input[name=taskIDS]").val(taskIDS.substr(0, taskIDS.length - 3));
</script>

Split control layer:

      String taskIDS = request.getParameter("taskIDS");
      String[] arr = taskIDS.split("<@>");
      for (String id : arr) {
	      ..
	      ..
      }

Comment:

Data Grid ( datagrid) component contains two methods to retrieve the selected rows:
getSelected: Get the first selected data line, if the line is not selected, it returns null, otherwise it returns record.
getSelections: Get all selected rows of data, returns an array of data elements records.

Published 123 original articles · won praise 214 · views 20000 +

Guess you like

Origin blog.csdn.net/o_o814222198/article/details/104753842