Hello all,
I’m working with DHTMLX Gantt library with knockout js and I could not get it to work with knockout’s binding handler. I have a simple div element in my html as shown below:
And this is how i’m using the dhtmlx gantt library to initialize my gantt chart:
!function ($) {
“use strict”;
if (typeof ko !== ‘undefined’ && ko.bindingHandlers && !ko.bindingHandlers.dhtmlxgantt) {
ko.bindingHandlers.dhtmlxgantt = {
update: function (element, valueAccessor, allBindings, viewModel, bindingContext) {
var value = valueAccessor();
var valueUnwrapped = ko.unwrap(value);
gantt.init(element);
gantt.parse(valueUnwrapped)
}
}
};
}(window.jQuery);
‘element’ in the above snippet is a simple json object that contains the data for the gantt chart. I have no errors in my browser console, but the chart is not being rendered on the specified div element. Any idea is greatly appreciated.