Author Topic: custom time editor  (Read 2732 times)

angelahlp

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 51
    • View Profile
custom time editor
« on: February 21, 2014, 02:39:36 am »
Does anyone have any examples for a custom time editor (like the date editor) ? TIA!

mailsrikanta

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: custom time editor
« Reply #1 on: March 31, 2014, 01:39:08 pm »
 var colM = [
      { title: "Date", width: 150, dataType: "String", editable: false   },

        { title: "Time", width: 150, dataType: "float", align: "center",editor: timeEditor, getEditCellData: saveCell }
      ];


 var timeEditor = function (ui,e) {
           var $cell = ui.$cell, data = ui.data, rowIndx = ui.rowIndxPage, colIndx = ui.colIndx;
           var dc = $.trim(data[rowIndx][colIndx]);
           $cell.css('padding', '0');
   
           var $inp = $("<input type='text' class='date4' maxlength='5' style='padding:0px;padding-bottom: 3px;border:0;vertical-align:bottom;width:147px;text-align: center;'/>")
           .appendTo($cell)
           .val(dc).timepicker({
          
               buttonImage: "/assets/calendar.png",
               onClose: function () {
                   $inp.focus();
                   saveCell
               }
           }).attr('readonly', 'true');
            .focus();
       }