在我的延迟对象返回数据后,我试图重新渲染我的 DOM 元素。我在控制台上调试它,似乎我的元素正在创建,但它从未显示到页面上。如果我添加静态内容,它会按预期工作。
m('div', {class: 'table-responsive'}, [
m('table', {class: 'table'}, [
m("thead", [
m('tr', [
m('th', '#'),
m('th', 'Groups'),
])
]),
m('tbody', findGroupsDeferred.promise.then(function(data){ // findGroupsDeferred returns when the promise is complete with my data.
data.group.map(function(group) {
return m("tr", [
m("td", [
m("input[type=checkbox] checked", {
value: group,
onclick: function (event) {
if (event.target.checked) {
ctrl.addGroup(ctrl.groups(event.target.value))
} else {
ctrl.removeGroup(ctrl.groups(event.target.value))
}
}
})
]),
m("td", group),
])
});
}))
])
]),