Pending knockout js 1.2. Binding in 1

Are there any options to suspend and resume binding in the knockout?

Version: knockout js 1.2. one

Our need to suspend binding stems from the following In some operations, we must load a large amount of data from the server. For example, multiple choices change the whole data, dynamically add rows to some tables, etc

Now, in the current scenario, the form is fully bound to the view model When we clear the combination and add each item, the view refreshes, so there is a significant delay If I have a way to pause the binding, I can pause, then load all the data into the ViewModel, and then resume the binding again

Solution

I think there is no way in knockout JS It's hard to say when you don't see the code, but it may be slow because you refresh observable arrays by clearing them and adding new items one by one Instead, you can refresh the entire array immediately:

...
self.manyItems = ko.observableArray();
...
function refreshItems(newItems){
    self.manyItems(newItems);
}
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>