[Time Picker Reactive] TypeError: $(...).mdtimepicker is not a function
time-picker-reactive
Forge component by Salman Ansari
Application Type
Reactive

Hi,

We are using this component in our Reactive web application to select the time values. On one screen there are 4 instances of this time picker. For each instance we are using a webblock on the screen.  In web block we have defined required javascript file. On the onReady event of web block we are initlizing the time picker. Below is the code.

 $('.time-picker').mdtimepicker(); //Initializes the time picker

  $('.time-picker').mdtimepicker().on('timechanged', function(e){

          $actions.AssignBookingTime(e.time);


});


Now when screen get loads all time pickers get load successfully most of the time but some time we get error "TypeError: $(...).mdtimepicker is not a function" on screen load. Not sure why but it happens randomly. 

Please suggest something or let me know if further more information is required.

Regards


Hi Vikas,

Would it be possible to share your oml and give the error screen shot?

Hi Salman,

Sorry, it will not be possible for me to share the oml as its part of a big client project. Error trace is like this :

TypeError: $(...).mdtimepicker is not a function
    at HTMLDocument.<anonymous> (https://pruvhis.kinetixglobal.com/form_hdf/scripts/form_hdf.Common.HDFStartDate.mvc.js?zk1i6Rr_YFoSp03u0VZGDA:489:30)
    at i (https://pruvhis.kinetixglobal.com/form_hdf/scripts/CKEditorReactive.jQuery.js?6UFeg3u2ti3W5L7eItUZlA:2:27065)
    at Object.add [as done] (https://pruvhis.kinetixglobal.com/form_hdf/scripts/CKEditorReactive.jQuery.js?6UFeg3u2ti3W5L7eItUZlA:2:27364)
    at n.fn.init.n.fn.ready (https://pruvhis.kinetixglobal.com/form_hdf/scripts/CKEditorReactive.jQuery.js?6UFeg3u2ti3W5L7eItUZlA:2:29429)
    at https://pruvhis.kinetixglobal.com/form_hdf/scripts/form_hdf.Common.HDFStartDate.mvc.js?zk1i6Rr_YFoSp03u0VZGDA:488:13
    at Controller.e.safeExecuteJSNode (https://pruvhis.kinetixglobal.com/form_hdf/scripts/OutSystems.js?p5eKvE3aS8b15CXklrM6cw:12:31300)
    at Controller._onInitialize$Action (https://pruvhis.kinetixglobal.com/form_hdf/scripts/form_hdf.Common.HDFStartDate.mvc.js?zk1i6Rr_YFoSp03u0VZGDA:356:12)
    at https://pruvhis.kinetixglobal.com/form_hdf/scripts/OutSystems.js?p5eKvE3aS8b15CXklrM6cw:13:10429
    at d (https://pruvhis.kinetixglobal.com/form_hdf/scripts/OutSystems.js?p5eKvE3aS8b15CXklrM6cw:2:11779)
at f (https://pruvhis.kinetixglobal.com/form_hdf/scripts/OutSystems.js?p5eKvE3aS8b15CXklrM6cw:2:11525)


Generally this error happened when we refresh the page.

Champion

Hi Vikash n salman Sir, 

I do not feel , I am much capable to comment here while component creator himself  present here. But I wanted to keep what I explored. 

I face same kind of error at browser console, when I changed the sequence of Required Script file. If Scripts.TimePicker is above the Scripts.mdtimepicker in that situation error can be seen at browser console. But It is occurring randomly not always.

I changed the sequence and it is working fine.  Hope this may contribute to reach at solution.

Regards, 

rahul

Hi Rahul,

Thanks for update. Let me give a try to this.

Regards

Hi Rahul,

You are always welcome. We all are learning and helping each other :)
Thank you for your suggestion. Let me try this too.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.