DateTimePicker not honouring 24 hr format in pre rendered column definition for cell filter

4 posts, 0 answers
  1. lorraine
    lorraine avatar
    6 posts
    Member since:
    Jun 2016

    Posted 07 Jun Link to this post

    I am trying to have the cell filter render a DateTimePicker with the parsed format as 24 hr - when i select 20.30 from the time picker portion it gets set in the rendered input as 03/06/2017 08:30 - I have tried numerous configurations for the template format arguments - could someone please point me in the right direction?

    dcolumns[ci]["type"] = 'date';
    dcolumns[ci]["filterable"] = {
         cell: {
                  showOperators: false,
                  template: function (args) {
                      args.element.kendoDateTimePicker({
                      timeFormat: "HH:mm",
                      format: "MM/dd/yyyy HH:mm",
                      parseFormats: ["MM/dd/yyyy hh:mm tt"]
                      });
                    }
       }
    }
  2. lorraine
    lorraine avatar
    6 posts
    Member since:
    Jun 2016

    Posted 07 Jun in reply to lorraine Link to this post

    also tried
    args.element.kendoDateTimePicker({
    timeFormat: "HH:mm tt",
    format: "MM/dd/yyyy HH:mm",
     parseFormats: ["MM/dd/yyyy HH:mm tt"]
    });
  3. lorraine
    lorraine avatar
    6 posts
    Member since:
    Jun 2016

    Posted 07 Jun Link to this post

    if I remove the 
    dcolumns[ci]["type"]="date";

    the 24hr time is honoured - but my column is displayed in the table as timestamp (the orignal data format)

    if I add 
    dcolumns[ci]["format"]="{0:HH:mm:ss tt}";
    my column is correctly formatted in date time BUT my 24 hour is no longer honoured

    can anyone advise as to correct kendo grid column definition for a timestamp displayed as date time and the correct filterable cell template definition to honour 24hr format ?

  4. lorraine
    lorraine avatar
    6 posts
    Member since:
    Jun 2016

    Posted 07 Jun Link to this post

    Solved 
    for anyone else having same issue

    to display the timestamp as datetime create a template for the column

    dcolumns[ci]["template"] = "#= kendo.toString(new Date(parseInt("+fieldName+")), 'yyyy-MM-dd HH:mm:ss')#";

    remove the type = date from the column definition

    code below

    var fieldName = dcolumns[ci]["field"];
     dcolumns[ci]["template"] = "#= kendo.toString(new Date(parseInt(" + fieldName + ")), 'yyyy-MM-dd HH:mm:ss')#";
     dcolumns[ci]["filterable"] = {
          cell: {
                  showOperators: false,
                   template: function (args) {
                         args.element.kendoDateTimePicker({
                                timeFormat: "HH:mm tt",
                                format: "dd/MM/yyyy HH:mm",
                                parseFormats: ["dd/MM/yyyy hh:mm tt"]
                          });
                    }
     }
    };

     

Back to Top