zoukankan      html  css  js  c++  java
  • easyui如何动态改变列的编辑属性

    动态改变列的编辑属性

    var tt=$('#dg').datagrid('getColumnOption', 'yearContent'); //通过列名获得此列
                        tt.editor={type:'textarea'}; //设置此列的编辑属性 如果禁用编辑 则设置 tt.editor={}

     新增一行时 yearContent 列可以编辑

        function append(){
                
                    if (endEditing()){                    
                        $('#dg').datagrid('appendRow',{});//新增一行
                        var tt=$('#dg').datagrid('getColumnOption', 'yearContent');
                        tt.editor={type:'textarea'};
                        editIndex = $('#dg').datagrid('getRows').length-1;
                        
                        $('#dg').datagrid('selectRow', editIndex)
                                .datagrid('beginEdit', editIndex);
                        
                        $("textarea").css("height","85px");                    
                    }            
            }

    点击一行时 yearContent 列不可以编辑

     function onClickRow(index,field,value){
                 
                if (editIndex != index){
                    if (endEditing()){    
                        var tt=$('#dg').datagrid('getColumnOption', 'yearContent');
                        tt.editor={};
                        $('#dg').datagrid('selectRow', index)
                                .datagrid('beginEdit', index);
                        editIndex = index;
                    } else {
                        $('#dg').datagrid('selectRow', editIndex);
                    }
                    $("textarea").css("height","85px");
                }
            }
  • 相关阅读:
    1026. 程序运行时间(15)
    C语言字符串/数组去重
    1025. 反转链表 (25)
    1024. 科学计数法 (20)
    1023. 组个最小数 (20)
    1022. D进制的A+B (20)
    1021. 个位数统计 (15)
    1020. 月饼 (25)
    前端001/正则表达式
    SSM001/构建maven多模块项目
  • 原文地址:https://www.cnblogs.com/heyesp/p/5826963.html
Copyright © 2011-2022 走看看