zoukankan      html  css  js  c++  java
  • jquery easyui datagrid()--数据网格操作(二)(--可编辑的数据--)

          function initTable(State,theGroup) {
            $('#dataTable').datagrid({
                url: rootUrl + 'Device/device_info/GetDataList',
                method: 'POST',
                queryParams: { 'State': State,'GroupName': theGroup},//-------提交参数
                idField: 'Id',
                fit: true,
                fitColumns: true,
                scrollbarSize:0,//------数据不多时内容整合去除多余留白
                singleSelect: false,
                selectOnCheck: false,//------选中复选框选中行,样式不好看丑,需要自定义样式
                checkOnSelect: true,//-----单击行选中复选框效果,if没有效果需要写单击行事件(onClickRow())
                //sortName: 'Id',
                //sortOrder: 'asc',
                //rownumbers: true,
                pagination: true,
                pageSize: 10,
                //nowrap: false,
                pageList: [10, 20, 30, 50, 100, 150, 200],//----分页参数必须设置自定义须写入js对象
                //showFooter: true,
                columns: [[
                    { title: 'ck', field: 'ck', checkbox: true },
                    { title: 'xxxx', field: 'Id',  200,hidden:'true'},
                    { title: 'xxxx', field: 'Device_Name',  200 },
                    { title: 'xxxx', field: 'Device_Ordernum',  200 },
                    {
                        title: 'xxxx', field: '__',  60, fixed: true,align:'center',
                formatter: function (value, row) { var html = '';                ....
                  
    return html; } } ]], onBeforeLoad: function (param) { },
           //-------关键操作(一、打开可编辑状态)--------// onDblClickCell:
    function (index, field) { if (editIndex != index) { if (endEditing()) { $('#dataTable').datagrid('selectRow', index).datagrid('beginEdit', index); editIndex = index; var ed = $('#dataTable').datagrid('getEditor', { index: index, field: field }); if (ed) { $(ed.target).combobox({ onLoadSuccess: function () { }, onChange: function () { }, }) } } else { setTimeout(function () { $('#dataTable').datagrid('selectRow', editIndex); }, 0); } } },
           //------关键操作(二、结束编写时返回的值)-----//  onEndEdit:
    function (index, row) { var ed = $('#dataTable').datagrid('getEditor', { index: index, field: 'GroupName', }); row.GroupId = $(ed.target).combobox('getValue'); row.GroupName = $(ed.target).combobox('getText'); } }); }
    //------需要引用的js------//    
      var editIndex = undefined;       function endEditing() {       if (editIndex == undefined) { return true }       f ($('#dataTable').datagrid('validateRow', editIndex)) {       $('#dataTable').datagrid('endEdit', editIndex);         editIndex = undefined;       return true;       } else {         return false;         }       }
     
  • 相关阅读:
    Codeforces Round #344 (Div. 2) C. Report 其他
    Codeforces Round #344 (Div. 2) B. Print Check 水题
    Codeforces Round #344 (Div. 2) A. Interview 水题
    8VC Venture Cup 2016
    CDOJ 1280 772002画马尾 每周一题 div1 矩阵快速幂 中二版
    CDOJ 1280 772002画马尾 每周一题 div1 矩阵快速幂
    CDOJ 1279 班委选举 每周一题 div2 暴力
    每周算法讲堂 快速幂
    8VC Venture Cup 2016
    Educational Codeforces Round 9 F. Magic Matrix 最小生成树
  • 原文地址:https://www.cnblogs.com/zxy-room/p/12501966.html
Copyright © 2011-2022 走看看