Author Topic: general date format  (Read 2346 times)

omerix

  • Pro Enterprise
  • Full Member
  • *
  • Posts: 148
    • View Profile
general date format
« on: July 17, 2020, 03:51:53 pm »
Hello,

Are you considering adding a general date format to the "options" sections?

Code: [Select]
var obj = {
     editable:true
    ,dateFormat:'dd/mm/yyyy' /*Other: 'dd.mm' , 'dd/mm/yyyy' */
}


1) This should come when editing manually. (dd/mm/yyyy)
2) It should come when choosing from the calendar. (dd/mm/yyyy)
3) It must be displayed in this format when it is displayed. (dd/mm/yyyy)





Code: [Select]
,{title:'Tarih',dataIndx:'TARIH1',dataType:'date',minWidth:24,width:85,cls:'',clsHead:'',align:'',halign:'center',hidden:false,editable:true
,editor: {type: 'textbox',init: HucreT},format:'dd/mm/yy',formatRaw:'yy-mm-dd',formatSel:'yy-mm-dd'
,filter: { crules: [{ condition:'between'}],menuIcon:false}
,render: function (ui) {return {attr:'title="'+ui.cellData+'"'} }
}


Code: [Select]
var HucreT = function (ui) {
var formatSel = ui.column.formatSel || 'dd/mm/yy';
//console.log(formatSel);

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:formatSel
,defaultDate: null
,changeMonth: true
,showButtonPanel: true
,changeYear: true
,showWeek: true
,showOtherMonths: true
,selectOtherMonths: 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();
}
});
};

Attachments: https://yadi.sk/i/LNcPRP_A_E189w