Author Topic: date format  (Read 4267 times)

omerix

  • Pro Enterprise
  • Full Member
  • *
  • Posts: 148
    • View Profile
date format
« on: March 20, 2019, 05:16:18 pm »
Hello,
The format I use: dd/mm/yy  (Day / Month / Year)


Screenshot:
1) Screen: https://yadi.sk/i/AfojWZ48deF0og
2) Filter:  https://yadi.sk/i/zFv9iiTxKqOCdg
3) Click cell:
    3a) Open Calendar: https://yadi.sk/i/BqJqadMNmlTXOA
    3b) Select Date: https://yadi.sk/i/4AVjkWpWNK57Yg ( February 8 )
    3c) After selection: https://yadi.sk/i/MtkGiISOg8xIeA ( August 2 ) The error is here!


This Code:
Code: [Select]
,{title: 'Boya Termin', dataIndx: 'SP_HEDEFTERMIN', width:85,dataType:'date',format:'dd/mm/yy',formatRaw:'dd/mm/yy',editable:true,clsHead:'pqu'
,filter: { crules: [{ condition:'between'}]}
,editor: {type: 'textbox',init: dateEditor}
,render: function (ui) {return {cls:ui.rowData['SP_HEDEFTERMINRENK']};}
}


Code: [Select]
var dateEditor = function (ui) {
var $inp = ui.$cell.find("input"),               
grid = this,
validate = function (that) {
var valid = grid.isValid({
dataIndx: ui.dataIndx,
value: $inp.val(),
rowIndx: ui.rowIndx
}).valid;
if (!valid) {
that.firstOpen = false;
}
};

//initialize the editor
$inp
.on("input", function (evt) {
/*validate(this);*/
})
.datepicker({
dateFormat:'dd/mm/yy',
showButtonPanel: true,
changeMonth: true,
changeYear: true,
showAnim: '',
onSelect: function () {
this.firstOpen = true;
/*validate(this);*/
},
beforeShow: function (input, inst) {
setTimeout(function(){
//to fix the issue of datepicker z-index when grid is in maximized state.
$('.ui-datepicker').css('z-index', 999999999999);
});
return !this.firstOpen;
},
onClose: function () {
this.focus();
}
});
}
« Last Edit: March 20, 2019, 05:18:12 pm by omerix »

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6307
    • View Profile
Re: date format
« Reply #1 on: March 21, 2019, 05:53:19 pm »
I don't see error in the screenshot. Can you provide a jsfiddle/plnkr.

That red triangle in the top left corner denotes dirty cell.

omerix

  • Pro Enterprise
  • Full Member
  • *
  • Posts: 148
    • View Profile
Re: date format
« Reply #2 on: May 09, 2019, 03:31:50 pm »
Hello Param,

Code:
http://jsfiddle.net/4pvfsmwq/

Data and Cell display:
https://yadi.sk/i/ggx9q0mOdqlg8g


It would be nice if we could save the format for all fields in the lang file.

dateFormat = "dd / mm / yy"
dateFormatFull = "MM / dd / yy"
« Last Edit: May 09, 2019, 03:37:33 pm by omerix »

arbyter

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 43
  • Retired IT Guy
    • View Profile
Re: date format
« Reply #3 on: May 23, 2019, 10:44:59 pm »
hi omerix
i found a workround.(quick and dirty). Just declare the date-field as string, then it will accept dd/mm/yyyy format.

{title: "Datum", width: 100, dataType: "string", dataIndx: "datum",format:'dd.mm.yy',formatRaw:'dd.mm.yy',....