Javascript 更新LightSwitch中的自定义控件
我正在根据数据库表中的布尔字段显示自定义文本Javascript 更新LightSwitch中的自定义控件,javascript,visual-studio-lightswitch,lightswitch-2013,Javascript,Visual Studio Lightswitch,Lightswitch 2013,我正在根据数据库表中的布尔字段显示自定义文本 myapp.BrowseAdverts.AdType_postRender = function (element, contentItem) { if (contentItem.data.AdType === true) $(element).append("Advert type = BANNER"); else $(element).append("Advert type = WOW"); }; 编辑列表中的选定元素(甚至添加
myapp.BrowseAdverts.AdType_postRender = function (element, contentItem) {
if (contentItem.data.AdType === true) $(element).append("Advert type = BANNER");
else $(element).append("Advert type = WOW");
};
编辑列表中的选定元素(甚至添加新项)后,除此自定义控件外,所有字段都将更新
如何设置“绑定”,以便在修改字段时更新自定义文本?我自己设法找到了解决方案:
contentItem.dataBind("value", function (value) {
if (value === true) {
$(element).text("BANNER");
} else {
$(element).text("WOW");
}
});