datagrid的editor默認編輯器擴展

$.extend($.fn.datagrid.defaults.editors, { 
  
    datetimebox: {   
        init: function(container, options){   
            var editor= $('<input/>').appendTo(container); 
            options.editable = false;//文本框變成時間框不能讓用戶輸入,不然出錯,必須加上該屬性
            editor.datatimebox(options);//把editor初始化成datatimebox時間框
            return editor;   
        },   
        getValue: function(target){   
           // return $(target).val();   
           //這麼寫是得到普通文本框的值,easyui的幾個框都有本身的setValue和getValue方法
             return $(target).datetimebox('getValue');
        },   
        setValue: function(target, value){   
            //$(target).val(value);   
            $(target).datetimebox('setValue');
        },   
        resize: function(target, width){   
            /*
            var input = $(target);   
            if ($.boxModel == true){   
                input.width(width - (input.outerWidth() - input.width())); 
  
            } else { 
  
                input.width(width);   
            }  
            */
             $(target).datetimebox('resize',width);//datetimebox控件的方法    
        },
         destory:function(target){
             $(target).datetimebox('destroy');//銷燬datetimebox的下拉麪板控件,input框不須要
         }
    }   
});
相關文章
相關標籤/搜索