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;         }       }
     
  • 相关阅读:
    结合php ob函数理解缓冲机制
    php中的require-once
    PHP面试题基础问题
    Jquery显示与隐藏input默认值的实现代码
    win7下cmd常用命令
    采用cocos2d-x lua 的listview 实现pageview的翻页效果之上下翻页效果
    采用cocos2d-x lua 制作数字滚动效果样例
    luac++
    lua相关笔记
    cornerstone知识点
  • 原文地址:https://www.cnblogs.com/zxy-room/p/12501966.html
Copyright © 2011-2022 走看看