Author Topic: Date Format When Pasting Data from Excel to Grid  (Read 8 times)

omerix

  • Pro Enterprise
  • Full Member
  • *
  • Posts: 160
    • View Profile
Date Format When Pasting Data from Excel to Grid
« on: February 04, 2025, 11:32:07 pm »
Hello,

When I paste data from Excel to the grid, only "yyyy-mm-dd" is accepted as the date format.

Is there a solution other than making datetype="string"?

Options:
Code: [Select]
fmtDate: 'dd/mm/yyyy',
fmtDateEdit: 'dd/mm/yyyy',
fmtDateFilter: 'dd/mm/yyyy'


colModel
Code: [Select]
{
  title: 'Date Column',
  dataIndx: 'date1',
  dataType: 'date',
  halign: 'center',
  desc: 'Process Date',
  hidden: false,
  editable: true,
  format: 'dd/mm/yyyy',
  editor: { type: 'textbox', init: dateU },
  filter: { crules: [{ condition: 'between' }], menuIcon: false }
}


dateU function
Code: [Select]
function dateU(ui) {
  ui.$cell.find("input")
    .datepicker({
      changeMonth: true,
      changeYear: true,
      dateFormat: pq.excelToJui(ui.column.format),
      showAnim: '',
      onSelect: function () {
        this.firstOpen = true;
      },
      beforeShow: function (input, inst) {
        setTimeout(function () {
          $('.ui-datepicker').css('z-index', 999999999999);
        });
      },
      onClose: function () {
        this.focus();
      }
    });
}


function dateB(ui) {
ui.$cell.find("input")
.bootstrapDatepicker({
format: ui.column.format,
})
.on('changeDate', function (e) {
$(this).focus();
$(this).bootstrapDatepicker('hide');
})
}

function date(ui) {
ui.$cell.find("input")
.attr("type", "date")
.on("focus", function () {
this.showPicker?.();
})
.click();
}

omerix

  • Pro Enterprise
  • Full Member
  • *
  • Posts: 160
    • View Profile
Re: Date Format When Pasting Data from Excel to Grid
« Reply #1 on: February 04, 2025, 11:40:44 pm »
Sample: