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

来源:互联网 发布:linux 删除命令行 编辑:程序博客网 时间:2024/05/27 10:44
//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);
      }
    }
  }
});
原创粉丝点击