天天看点

jqueryeasyui-datagrid-编辑器扩展-日期时间编辑器

//datagrid 编辑器扩展

 $.extend($.fn.datagrid.defaults.editors, {

   datetimebox: {

     init: function (container, options) {

       var input = $('<input type="text" class="easyui-datetimebox">')

         .appendTo(container);

       //编辑框延迟加载

       window.setTimeout(function () {

         input.datetimebox($.extend({ editable: false }, options));

       }, 10);

       //input.datetimebox($.extend({ editable: false }, options));

       return input;

     },

     getValue: function (target) {

       return $(target).datetimebox('getValue');

     },

     setValue: function (target, value) {

       $(target).val(value);

       window.setTimeout(function () {

         $(target).datetimebox('setValue', value);

       }, 150);

     },

     resize: function (target, width) {

       var input = $(target);

       if ($.boxModel == true) {

         input.width(width - (input.outerWidth() - input.width()));

       } else {

         input.width(width);

       }

     }

   }

 });      

继续阅读