Hello, I am looking for a way to subscribe to an event on the dataSource of an igCombo that uses loadOnDemand and dataSourceUrl. Specifically, I am looking to use "urlParamsEncoded". It appears that a dataSource is generated on initialization but I have hit a wall trying to find the event. I am unable to create an $.ig.dataSource and use this on the combo because it breaks the loadOnDemand functionallity. I am using v2013.1. Thanks.
Hi, Bertm13.
Sorry for the late response.
The igDataSource itself doesn't support load on demand, you are right. What you can do is to attach to the dataBound igCombo event. It is fired every time a data is requested on demand. And inside that event you have access to the data source, therefore to its urlParamsEncoded setting. There you can attach to the handler or whatever else you want to do:
dataBound: function (evt, ui) { ui.dataSource.settings.urlParamsEncoded = function (owner, params) { };}
But be careful because this will attach new handler every time new data is requested on demand.
Outside that event you can also use the following code, but only if you are sure that the control is already bound to data:
$("#combo").igCombo("getDataSource").settings.urlParamsEncoded = function (owner, params) { };
I hope this will help you and don't hesitate to ask if you have more questions.
Best regards,
Nikolay Alipiev
Thanks Nikolay.
The first solution you posted would probably work in my situation. However, the solution I came up in the meantime seems simpler. What I did is created my own igJSONPDataSource and set it to the combo's dataSource property. I modified the source (infragistics.lob.js) slightly:
line: if (lod && lod.enabled && (url || dsStr)) {
replaced with: if (lod && lod.enabled) {
This allows me to use a dataSource and continue to use load on demand. I understand that there may be some things that break if I was to set other properties besides dataSource (url) and a few event handlers, but that is all I am using it for.
Hi, Bertm.
I'm glad to hear that you were able to resolve it by yourself. The only problem with changing the control code can be that it may affect some other functionality. But as far it is working for you, this is great. Thank you again for using our product.