• EasyUi datagrid(onClickCell:用户单击一个单元格时触发 ) 單擊編輯 editor:{type: 'combobox'}


    1.columns列[一個單元格] 添加combobox下拉選項

     $("#userGrid").datagrid({

    singleSelect: true,
                onClickCell: function (index, field, value) {
                    //Field = field;
                    //                var rows = $('#' + UserGrid).datagrid('getRows'); //获得所有行
                    //                var row = rows[index]; //根据index获得其中一行。
                    //                WorkidValue = row.Workid;


                    debugger
                    if (client.endEditing()) {    //endEditing:自定義方法
                        $('#' + UserGrid).datagrid('selectRow', index)
                            .datagrid('editCell', { index: index, field: field });   //editCell:自定義方法
                        editIndex = index;  //editIndex:全局變量
                    }
                },

    columns: [[ {
                    field: 'Name',
                    title: '排班出勤',
                    80,
                    align: 'center',
                    editor: {type: 'combobox',options: {}}
                    sortable: true
                    //hidden:hidden
                }]]

    });

     endEditing: function () {
            if (editIndex == undefined) { return true }
            if ($('#' + UserGrid).datagrid('validateRow', editIndex)) {
                $('#' + UserGrid).datagrid('endEdit', editIndex);
                editIndex = undefined;
                return true;
            }
            else {
                return false;
            }
        },

     //userGrid單行編輯點擊事件
        $.extend($.fn.datagrid.methods, {
            editCell: function (jq, param) {
                return jq.each(function () {
                    var opts = $(this).datagrid('options');
                    var fields = $(this).datagrid('getColumnFields', true).concat($(this).datagrid('getColumnFields'));
                    for (var i = 0; i < fields.length; i++) {
                        var col = $(this).datagrid('getColumnOption', fields[i]);
                        col.editor1 = col.editor;
                        if (fields[i] != param.field) {
                            col.editor = null;
                        }
                    }
                    $(this).datagrid('beginEdit', param.index);
                    for (var i = 0; i < fields.length; i++) {
                        var col = $(this).datagrid('getColumnOption', fields[i]);
                        col.editor = col.editor1;
                    }
                });
            }
        });

  • 相关阅读:
    1 3
    linux常用命令
    linux的目录结构
    linux的shell编程
    linux的IP配置
    linux安装
    linux简介
    ubuntu16.04上系统管理服务和配置
    PXE
    RPC框架原理
  • 原文地址:https://www.cnblogs.com/popo1/p/12603922.html
Copyright © 2020-2023  润新知