EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: fornax on October 28, 2013, 05:13:43 PM



Title: eDataGrid Time (DateTimeBox, TimeSpinner)
Post by: fornax on October 28, 2013, 05:13:43 PM
Hello,

looks nice, works great and nearly get all Newby-Questions answered in the Forum. Thanks sworthy!

One thing I did not find (using EUI 1.3.4) and missing in eDataGrid is a (dropdown) Time-View: TimeSpinner or DateTimeBox.

Maybe I can stop searching if there is none of these available or solve it in any other way?

Thanks a lot!


Title: Re: eDataGrid Time (DateTimeBox, TimeSpinner)
Post by: stworthy on October 28, 2013, 07:58:41 PM
The 'timespinner' and 'datetimebox' editors should be extended before applying them.


Title: Re: eDataGrid Time (DateTimeBox, TimeSpinner)
Post by: fornax on October 29, 2013, 01:40:15 AM
Thanks ... May you have an Example for these?
I am not really firm in extending editors  :o


Title: Re: eDataGrid Time (DateTimeBox, TimeSpinner)
Post by: finzaiko on July 19, 2014, 10:03:11 PM
Yes, I try to extend edatagrid editor still not work even the last version :
Code:
$.extend($.fn.edatagrid.defaults.editors,
 { datetimebox: { init: function(container, options) { var input = $('<input type="text" class="easyui-datetimebox">').appendTo(container); return input; }, destroy: function(target) { $(target).remove(); }, getValue: function(target) { return $(target).val(); }, setValue: function(target, value) { $(target).val(value); }, resize: function(target, width) { $(target)._outerWidth(width); } }
--------
<th field="tanggal" width="150" editor="datetimebox">tanggal</th>


Title: Re: eDataGrid Time (DateTimeBox, TimeSpinner)
Post by: stworthy on July 20, 2014, 05:34:34 PM
Try this:
Code:
$.extend($.fn.datagrid.defaults.editors, {
  datetimebox:{
    init:function(container, options){
      var input = $('<input>').appendTo(container);
      input.datetimebox(options);
      return input;
    },
    destroy:function(target){
      $(target).datetimebox('destroy');
    },
    getValue:function(target){
      return $(target).datetimebox('getValue');
    },
    setValue:function(target,value){
      $(target).datetimebox('setValue',String(value));
    },
    resize:function(target,width){
      $(target).datetimebox('resize',width);
    }
  }
})


Title: Re: eDataGrid Time (DateTimeBox, TimeSpinner)
Post by: finzaiko on July 21, 2014, 02:32:42 AM
Thanks stworthy, its work.


Title: Re: eDataGrid Time (DateTimeBox, TimeSpinner)
Post by: fornax on October 22, 2014, 08:02:23 PM
Jepp! Thanks stworthy!

Finally everything works :-)