javascript - Manipulating datePicker CSS on $(document).ready -


i trying enable/disable date pickers depending on other widgets (checkboxes , numeric text boxes). when try call datepicker.enable() true or false parameter, error because datepicker isn't ready yet. seems kendo widgets aren't ready until $(document).ready too. there events or tell me when date picker ready manipulated ? using settimeout feels wrong.

here sample of code.

$(document).ready(function () {     changedatepickersstate(); });  function changedatepickersstate() {     var input = $('#mycheckbox:checked')     var bool = input.length != 0 ? true : false;     enabledatepickerforcheckbox('mydatepicker', bool);  function enabledatepickerforcheckbox(inputname, inputvalue) {     var datepicker = $('#' + inputname).data("kendodatepicker");     if (inputvalue == true) {         datepicker.enable(true);     }     else {         datepicker.enable(false);         datepicker.value(null);     } } 

thanks in advance.

i forgot mention im using kendo mvc, anyway got answer forum:

the kendo ui widgets not fire events when initialized, can count on existence if include custom logic inside document.ready handler, added @ end of page . ensure handler executed after widget initialization statements, depend on document.ready. no settimeout required in case.

some widgets such grid or listview can initialized, still not populated in document.ready. depending on exact scenario, can use corresponding widget's databound event execute custom logic.

thanks everyone!


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -