0

Update View or Reload view

Hello everyone,

I have already created a sidebar view, and when I press the back button, I don't want to save this view in history stack, what should I do?

For example, $API.perfectUser.user.user_login is a variable global.
CODEBOX
var bottom1 = new KONtx.control.TextButton({
label: 'username:' + $API.perfectUser.user.user_login,
styles: {
vOffset: text_button_header.outerHeight
},
textStyles: {
color: '#FFFFFF',
fontSize: KONtx.utility.scale(18),
paddingLeft: KONtx.utility.scale(5),
hAlign: 'center',
vAlign: 'center'
},
events: {
onSelect: function(event){
var dialog = new KONtx.dialogs.Alert({
title: "Email",
message: $API.perfectUser.user.user_login,
buttons: [{
label: "back"
}]
});
dialog.show();
}
}
}).appendTo(this);


When pressing back button and $API.perfectUser.user.user_login changed, and I want to reload this view, but the data in "label" doesn't change, because the view doesn't refresh

I tried
CODEBOX
loadview("id",null,true);

but it seems that doesn't work

Thanks for helping!

Yinan

by
4 Replies
  • Take a look at the KONtx.messages framework.

    It allows you to subscribe to information stored in the application and trigger events when it is updated. This should address a lot of the above.

    Also, look at the KONtx.application.loadView() function. There is an optional value for the function that allows you to skip saving it in the history stack.
    0
  • Whoops. Misread the stuff on loading the view.

    The KONtx.message should get you all straightened out.
    0
  • QUOTE (WidgetRealm @ Nov 12 2010, 11:24 AM) <{POST_SNAPBACK}>
    Take a look at the KONtx.messages framework.

    It allows you to subscribe to information stored in the application and trigger events when it is updated. This should address a lot of the above.

    Also, look at the KONtx.application.loadView() function. There is an optional value for the function that allows you to skip saving it in the history stack.


    I have already tried loadview, but it dosen't work

    In fact, what I want to do is just to reload the view without save the old variable global in the label of a button, just to refresh the new view
    0
  • Ok... Try

    CODE
    KONtx.application.reloadView({datatopass},(bool to save in stack))


    You might be very well served looking at the documentation in the WDK around KONtx.application - page 137.
    0

Recent Posts

in Getting Started / Beginners - Yahoo! TV Widgets