문제

I am displaying custom text based on a Boolean field from a table in my database.

myapp.BrowseAdverts.AdType_postRender = function (element, contentItem) {
    if (contentItem.data.AdType === true) $(element).append("Advert type = BANNER");
    else $(element).append("Advert type = WOW");
};

After I edit the selected element from a list (or even add a new item), all the fields will update except for this custom control.

How can I setup the "binding" so the custom text will update when a field is modified?

도움이 되었습니까?

해결책

I managed to find the solution myself:

contentItem.dataBind("value", function (value) {
        if (value === true) {
            $(element).text("BANNER");
        } else {
            $(element).text("WOW");
        }
    });
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top