0

I'm using KO to bind data in Kendo Window. This is a sample how my html looks like

<form id="formid">
   <span id="window">
     <span data-bind:"html:content"></span>
   </span>
</form>

formId is binded with viewModel. And when document is ready I'm getting window content (html with viewModel to this window) via ajax. I do it like bellow:

ko.mapping.fromJS(newObj, {}, viewModel);
ko.applyBindings(viewModel, element);

newObj - is JSON object with information about fe. names of buttons etc In newObj there are other properties. I saw that after executing ko.mapping.fromJSsome properties has getSubscriptionsCount()==1. And when I try to change those properies, my window is rendering once more. document ready is triggered once again

Why I get in some properties already with subscribers after ko.mapping.fromJS and some without it? Or maybe this is a problem with kendo window

cin
  • 31
  • 5
  • Can you show your document.ready function? – Jason Spake Mar 13 '17 at 23:44
  • in document.ready in form I have `ko.applyBindings(viewModel, document.getElementById('formId));` and ajax request to get content to viewModel and in success `viewModel.content(data)` – cin Mar 14 '17 at 08:08
  • I saw that when you touch observable property in object f.e viewModel.Name() KO automaticly add's subscriber so I think this is not a problem but problem is why kendo window tries to rerender content when was some change in viewModel of kendowindow. This is happening as well when I execute (on some property) method valueHasMutated. – cin Mar 14 '17 at 08:18
  • adding the subscriber is also not happening with all properties. – cin Mar 14 '17 at 08:25
  • I've changed this, and now I'm loading content via jquery not by KO. And it works. – cin Mar 14 '17 at 16:29

0 Answers0