Hi I needed a knockout binding extension for the igChart, this is what a came up with.
// Infragistics Chart. (function ($) { ko.bindingHandlers['igChart'] = { init: function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) { var value = ko.utils.unwrapObservable(valueAccessor()); var bindings = ko.bindingHandlers['igChart']._getBindings(allBindingsAccessor); $(element)[bindings.igChart.type](bindings.igChart.options); }, update: function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) { var bindings = ko.bindingHandlers['igChart']._getBindings(allBindingsAccessor); $(element)[bindings.igChart.type]({ dataSource: bindings.igChart.options.dataSource }); }, _getBindings: function (allBindingsAccessor) { var bindings = allBindingsAccessor(); return jQuery.extend({}, bindings, { dataSource: typeof bindings.igChart.options.dataSource == "function" ? bindings.igChart.options.dataSource() : bindings.igChart.options.dataSource }); } }; })(jQuery);
Hello christoffelleroux,
Thank you for sharing this with the community, it will be helpful for others that want to use knockoutjs with igChart.