Hi,
Is there any working example for the igCombo or any other control for that matter, with data that comes from a REST end point (or any other late data that need to be rebind).I cant seem to make it work.
If I use any method like the $('#id').igCombo('dataBind') when I get the data, I always get the "cannot call methods on igCombo prior to initialization" error.I tried to re initialize the control like $('#id').igCombo(options) - but again, it does not work/
any help will be nice
Hello Amos,
Thank you for contacting us.
Yes, there is such a sample - http://www.igniteui.com/combo/load-on-demand.
The error you get when you call databind is because you do this before the combo is initialized. You could attach to rendered event and do some logic there, if you want to be after initialization - http://www.igniteui.com/help/api/2016.2/ui.igCombo#events:rendered.
If this does not help, you could send me a working isolated sample so I could investigate. You could make a JSFiddle if it convenient.
I am looking forward to hearing from you.
Hi,Thanks for the response.
I uploaded files to show my case.the files are taken from the Angular2 sample page on github.
these two file are the igComboTemplate.html file - where I just gave the control an id, and the second file the the app.ts, where I changed the code so the data will be fetched with a 3 seconds delay, to mock the data fetching from the server.so i order to get the sample going, you will need to get the "igniteui-angular2-master" from https://github.com/IgniteUI/igniteui-angular2and replace these two files in the igCombo directory.
thanks in advance
When you set a dataSource it calls the dataBind method automatically.
I am attaching a working sample.
Please let me know if I could be of further assistance.
Hi,Your sample works as expected...I cant seem to get it to work with a async data fetching - http call or any other way.with a synchronous data source, it seems to work. You can even just add a settTimeout of a second or two in the render event before calling the fetchData() method in your sample.
rendered: (ev, ui) => { setTimeout(()=> { this.fetchData(ui.owner); },1000);}
thanks
Hello,
Please try with calling dataBind after you set the dataSource like this:
fetchData(combo) { combo.options.dataSource = Northwind.getData(); combo.dataBind(); }
and tell me whether it is working correctly with async calls.
OK,
Now how do I do it with datachart?
There should not be any difference when databinding with our data chart.
If the issue is different, please create a new thread for better tracking.
If not, please send me a sample so I could further investigate.
Hi,Thanks for the quick response.I managed to get the late binding to work in the data-chart.In the data-chart control, there is no rendered event and way (that I found) to get the control (ui.owner).for the data-chart control, the jQuery option $("#chart").igDataChart("option","dataSource",date); - seem to work, as opposed to the igCombo.There is a bit of inconsistency between the controls, and it is time consuming, to try and figure out how to deal with each control separately. thanks anyway for you response.