Author Topic: Date-Picker Masking  (Read 316 times)

developer2

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 6
    • View Profile
Date-Picker Masking
« on: July 04, 2022, 01:46:25 pm »
Hi paramvir,

I am unable to apply date mask on date picker text cell in pq-grid. My previous code working properly.
editor: {
 type: function (ui) {
if (ElementType == "xbrli:dateItemType") {
                                     var $cell = ui.$cell,
                                       rowData = ui.rowData,
                                        dataIndx = ui.dataIndx,
                                        cls = ui.cls;

                                    //dc = $.trim(rowData[dataIndx]);
                                    //$cell.css('padding', '0');

                                    var $inp = $("<input data-inputmask-alias='dd-mm-yyyy' data-inputmask-inputformat='dd-mm-yyyy' type='text' id='" + dataIndx + "' name='" + dataIndx + "' class='" + cls + " pq-date-editor' style='position: relative; z-index: 100;border: 3px solid rgba(0,0,0,0);'/>")
                                        .appendTo($cell).val(dc).inputmask()
                                     .attr('readonly', 'readonly') // not editable remove by jinali(24 feb 2022).
                                       .val(dc).datepicker({
                                            changeMonth: true,
                                          changeYear: true,
                                           dateFormat: "dd-mm-yy",
                                           firstDay: 1,
                                           yearRange: "-150:+20",
                                            onClose: function () {
                                                $inp.focus();
                                            }
                                        });
                                    $cell.append($inp);
}
  }
}
But after version updated this code is not working so please guide us. How do put date masking?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Date-Picker Masking
« Reply #1 on: July 04, 2022, 07:55:41 pm »
As discussed earlier and mentioned in upgrade guide, editors have to be initialized in editor.init callback instead of editor.type

You need to initialize inputmask in editor.init callback in v8.4.0

Please share a jsfiddle if you need more help.