Author Topic: Datepicker locale  (Read 920 times)

Rimokas

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 32
    • View Profile
Datepicker locale
« on: August 31, 2021, 01:13:03 pm »
Hi,
after some unsuccessful search I'm asking how to change datepicker locale.
I need it to set for lithuanian, "lt".

I found one sample with formatting datepicker :

Code: [Select]
var dateEditor2 = function( ui )
         {
            var $cell = ui.$cell,
            rowData = ui.rowData,
            dataIndx = ui.dataIndx,
            cls = ui.cls,
            dc = $.trim(rowData[dataIndx]);
            $cell.css('padding', '0');
            var $inp = $("<input type='text' id='" + dataIndx + "' class='" + cls + " pq-date-editor' />")
            .appendTo($cell)
            .val(dc)
            .datepicker({
             format: "yy-mm-dd",
             autoclose: true,
             onClose: function () {
                  $inp.focus();
             },
             regional: 'lt'
            });
            //$( "#" + dataIndx ).datepicker( $.datepicker.regional["lt"] );
            //$inp.datepicker( $.datepicker.regional[ "lt" ] );

But all last 3 lines not set it to lithuanian ... :(

Data col model :

Code: [Select]
         obj.colModel = [
            { title: "Order ID", width: 100, dataIndx: "ord_id", editable: false },           
            { title: "Product Id", width: 190, dataIndx: "item_id" },
            { title: "Product Name", width: 250, dataIndx: "item_name", editable: false },
            { title: "Quantity", width: 100, dataIndx: "ord_qnt", dataType: "integer", align:"right" },           
            { title: "Order Date", width: 100, dataIndx: "ord_date", dataType: "date", editor: {type: dateEditor2} },

Any help ? Thanks in advance ...

Rimokas

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: Datepicker locale
« Reply #1 on: August 31, 2021, 03:08:27 pm »
Solved ... :)

Simply downloaded "lt" source from "https://github.com/jquery/jquery-ui/tree/main/ui/i18n" and added it to dependencies. Works fine!