Home Analyst Portal

DateTimePicker change interval issues

Cory_BoweCory_Bowe Customer Adept IT Monkey ✭✭
When using a DateTimePicker on one of our offerings, as well as on our CR form, if we set the interval to 15 the portal doesn't save the input from that field.

We set it using this method and it does indeed set the interval:
$('input[data-control="dateTimePicker"]').kendoDateTimePicker({ interval: 15 <span>});</span> 

We haven't seen any errors from the portal and it snows nothing in user input.

Thank you!

Best Answer

  • seth_coussensseth_coussens Member Ninja IT Monkey ✭✭✭✭
    Answer ✓
    $('input[data-control-bind="ScheduledStartDate"]').kendoDateTimePicker({interval:15})


    Using the above (similar but more exact to yours) it sets the interval and saves the time correctly on the CR form.

    I then attempted the same thing using a more generic selector on an Advanced RO and it worked there as well.



    So I can't say for sure what the issue is, but I can tell you this works. Maybe share your code with how you are implementing the jQuery call?

Answers

  • seth_coussensseth_coussens Member Ninja IT Monkey ✭✭✭✭
    Answer ✓
    $('input[data-control-bind="ScheduledStartDate"]').kendoDateTimePicker({interval:15})


    Using the above (similar but more exact to yours) it sets the interval and saves the time correctly on the CR form.

    I then attempted the same thing using a more generic selector on an Advanced RO and it worked there as well.



    So I can't say for sure what the issue is, but I can tell you this works. Maybe share your code with how you are implementing the jQuery call?
  • Cory_BoweCory_Bowe Customer Adept IT Monkey ✭✭
    We must have been having some issues with the MP we're using for the Offering to CR setup.  It started working fine with no intervention.

    Thank you!
  • Cory_BoweCory_Bowe Customer Adept IT Monkey ✭✭
    edited February 2017
    @seth_coussens We put this code back into our portal:

            $(".control-label:contains('Scheduled Start Date')").next().find(".k-input").kendoDateTimePicker({interval:30});
            $(".control-label:contains('Scheduled End Date')").next().find(".k-input").kendoDateTimePicker({interval: 30});

    It seems to be altering the requirement for data validation. If we change the interval, in an offering it will save it and not apply any text. In the form it will pop up the message about the field being required. If they click inside the text box or we do a .keyup() it will accept the input, otherwise it shows no input.

    This is in portal version 7.2.2012.1, it seems to be working in our dev environment running 7.3.
  • Cory_BoweCory_Bowe Customer Adept IT Monkey ✭✭
    I got it working with:
        $(".control-label:contains('Scheduled Start Date')").next().find(".k-input").data("kendoDateTimePicker").timeView.options.interval = 30;
        $(".control-label:contains('Scheduled End Date')").next().find(".k-input").data("kendoDateTimePicker").timeView.options.interval = 30;

    Just a guess, but maybe the previous script was trying to run before the controls were initialized for some people. This method seems to set it before it gets created and then it pops up with the 30 minute interval.
  • Tom_HendricksTom_Hendricks Customer Super IT Monkey ✭✭✭✭✭
    Actually, you do have the correct code now (I am also guilty of posting this with the wrong syntax).  The reason the other way does not work as well is because

    This initializes the control, sometimes duplicating it on top of itself, in a few cases:
    $(object).kendoControlOfSomeType(options)

    This sets the properties of an existing control:
    $(object).data('kendoControlOfSomeType').options({foo: 'bar'})

    The kendo documentation, while correct, can be misleading since most of their examples use the first syntax.  They are showing you how to create controls.  We need to modify controls.  They do have examples of this too, but in my experience it is usually buried further within the docs.

  • Cory_BoweCory_Bowe Customer Adept IT Monkey ✭✭
    @Tom_Hendricks, that makes so much sense.  Thanks for the explanation!
Sign In or Register to comment.