Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
460
igGrid and igDatePicker display/input format for date column
posted

Hi,

I want to change the datepicker's display and input format for my date column's filter row in the igGrid. How do you achieve this? 

So far I have tried setting dateInputFormat and dateDisplayFormat for columnSettings under filtering but to no avail. I have also tried to change the datepicker format once it has been initialized but I have no Id to retrieve it with (none that seems to get it at least) since it is created by the grid and only linked via a css class. 

Any help would be much appreciated!

Best Regards

Fredrik

 

Parents
  • 23953
    Verified Answer
    Offline posted

    Hello Fredrik,

    This can be achieved, although not from the filtering columnSettings. The idea is to get the reference to the igEditor instance for the date column filter editor and set its dateDisplayFormat and dateInputFormat options. Here is an example code:

    $("#grid1").on("igcontrolcreated", function (evt, ui) {
    $("#grid1>thead>tr>td:eq(5)>span").igEditor("option", "dateDisplayFormat", "dd/MM/yyyy");
    $("#grid1>thead>tr>td:eq(5)>span").igEditor("option", "dateInputFormat", "dd/MM/yyyy");
    });

    In this example the index 5 in the jQuery selector indicates the index of the date column in the grid. Note: you should put this code before the grid creation code.

    Attached you can find a complete sample.

    Hope this helps,
    Martin Pavlov
    Infragistics, Inc. 

    igGridFiltering_datefilter_format.zip
Reply Children