现在的位置: 首页 > 综合 > 正文

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

2013年10月14日 ⁄ 综合 ⁄ 共 783字 ⁄ 字号 评论关闭

//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);
      }
    }
  }
});

抱歉!评论已关闭.