これはあなたの探している答えではないかもしれませんが、それを行う方法の1つになる可能性があります。 私は、[追加]を持つオブジェクト内の配列をラップし、あなたが今
Collection.Add()
と
Collection.Remove()
を呼び出すことができます
var Collection = (function() {
var collectionArray = new Array();
//"private" methods
function updatePageDivs()
{
//Logic to update your Divs
}
//"public" methods
return{
Add: function(element){
collectionArray[collectionArray.length] = element;
updatePageDivs();
},
Remove: function(element){
//other logic to remove elements and to trigger the updatePage
}
}
});
(配列を変更したり、他の機能)メソッドを削除します
あなたのjavascriptコレクションを変更します。どちらもあなたのpagedivsを更新します。
KOがまだやっていないことは何をしたいですか? – Tuan
私はあなたの前の質問にもっと答えを受け入れるでしょう。 – isNaN1247