I have a scenario that is broken and need some help. My situation is this :
How do I fix this? I have a few thoughts :
None of these are very elegant, but #3 would be the most robust solution. Is there another approach I should be using? If not, how do I perform the check in #3 above?
Thank you
Hello CJ,
Are you by any chance using the MVC wrapper? The MVC Wrappers for igEditor related controls instantiate igEditor control on the client side so you should use igEditor instead of igTextEditor, igDatePicker, etc. in order to use the API. The same is for the event handling.
Please read Configuring igEditors at Runtime topic for more information, especially the Bind events after initialization and Set options after initialization sections.
In order to check if a widget is initialized, you could use a similar approach to this one:
if ($("#gridTarget").data("igGrid") !=null) {
//do something
}
In general this exception could be caused by various reasons. For example here are several forum threads with similar issue:https://es.infragistics.com/community/forums/f/ignite-ui-for-javascript/87633/cannot-call-methods-on-igeditorfilter-prior-to-initialization-attempted-to-call-method-setfocushttps://es.infragistics.com/community/forums/f/ignite-ui-for-javascript/76295/error-cannot-call-methods-on-iggridhiding-prior-to-initializationhttps://es.infragistics.com/community/forums/f/ignite-ui-for-javascript/94841/cannot-call-methods-on-iggridgroupby-prior-to-initialization-attempted-to-call-method-option
Please let me know if you have more questions related to the topic.
Hello,
No, I am not using the MVC wrapper. I looked at the help topics you suggested but am not sure how or if they can help fix this situation. My problem is the page loading is automatically triggering an ONCHANGE event, which I have set to manipulate some IG controls, however they don't exist yet because they haven't been initialized yet. Are you suggesting that the initialization of IG controls can be done before the document.ready function AND before the DOM triggers an ONCHANGE event?
As for the check of a control being initialized, would it be be something like this for editors?
if ($("#NumInputID").data("igNumericEditor") !=null) { //do something };
if ($("#DateInputID").data("igDatePicker") !=null) { //do something};
Thanks
Thank you for the details.For the igNumericEditors for example it could look like:
if ($("#numericEditor").data("igNumericEditor") != undefined || null) { //do something };
Also it is always better to use the inbuilt/API events like selectionChanged, to work with the widget. This will ensure the event is fired at the appropriate moment.I am also attaching a code sample illustrating the order of which the events fire. Just start the sample, open the console and play a bit with the igCombo. onchange fires after the widgets initialization. I hope this helps you implement your requirements.In general it will be best if you share the code in use or a code sample reproducing the issue for every particular case, so better assistance could be provided.