一個特性,這是我的代碼,其是不工作knockout.js ko.mapping.fromjs包括在結合
var getUpdates = setInterval(function() {
$.getJSON("@Url.Action("GetLists", "Home")?id=" + self.selectedboard(), function (data) {
var mapping = {
// only include these two properties
'include': ["cardlists"]
}
ko.mapping.fromJS(data, mapping, self.lists);
ko.applyBindings(helloWorldModel);
});
}, 3000);
數據被返回
[{ 「板卡ID」:1,「boardname 「:」 asdasd」, 「listid」:15, 「LISTNAME」: 「asdasd」, 「cardvisiblity」:真 「showlist」:假 「listremove」:假 「showRenderTimes」:假 「cardlists」:[{ 「CardId中」:23, 「cardname」: 「7」, 「listid」:15},{ 「CardId中」:24, 「cardname」: 「3」, 「listid」:15},{ 「CardId中」:27, 「cardname」: 「asdasd」, 「listid」:15},{ 「CardId中」:38, 「cardname」: 「asdasd」, 「listid」:15}]},{ 「板卡ID」:1, 「boardname」: 「asdasd」, 「listid」:22, 「LISTNAME」: 「asdasd」,」 cardvisiblity 「:真」 showlist 「:假」 listremove 「:假」 showRenderTimes 「:假」 cardlists 「:[{」 CardId中 「:33,」 cardname 「:」 asdasd」, 「listid」:22}, { 「CardId中」:39, 「cardname」: 「asdasd」, 「listid」:22},{ 「CardId中」:41, 「cardname」: 「qdasd」, 「listid」:22}]},{ 「板卡ID」 :1, 「boardname」: 「asdasd」, 「listid」:23, 「LISTNAME」: 「asdasd」, 「cardvisiblity」:真實的, 「showlist」:假的, 「listremove」:假的, 「showRenderTimes」:假」 cardlists 「:[{」 CardId中 「:34,」 cardname 「:」 asdasd」, 「listid」:23},{ 「CardId中」:40 「cardname」: 「asdasd」, 「listid」:23}]}, { 「板卡ID」:1, 「boardname」: 「asdasd」, 「listid」:24, 「LISTNAME」: 「asdasd」, 「cardvisiblity」:真 「showlist」:假 「listremove」:假 「showRenderTimes」 :假 「cardlists」:[{ 「CardId中」:35, 「cardname」: 「qweqwe」, 「listid」:24},{ 「CardId中」:36, 「cardname」: 「asdasd」, 「listid」:24 },{ 「CardId中」:37, 「cardname」: 「asdasd」, 「listid」:24},{ 「CardId中」:42, 「cardname」: 「sdfsdf」, 「listid」:24},{ 「CardId中」 :43,「cardname」:「asdasd」,「listid」:24}]}]
如何在綁定中僅包含cardlist?
如何在綁定中排除showRenderTimes?
忽視的手段,例如,如果cardvisiblity是假它將保持假的?如果它來了,它不會受到影響 – maztt
不,這意味着如果'cardvisiblity'是你的對象的一部分,你告訴映射插件忽略映射的這個屬性。它不會成爲綁定模型的一部分。 –
cardvisiblity不會成爲self.lists的一部分嗎? – maztt