2

In my project I make a TabView programmatically and expect it to update its TabViewItem (changing title for example) whenever I set myTabView.items = newArray. Unfortunately, it doesn't work like that. Any help will be greatly appreciated.

Here are my code when I generate the TabView:

function initTabview(tabList: Array<string>) {
    let items = [];
    let myTabView = page.getViewById("myTabView");
    for (let i in tabList) {
        let stackLayout = new StackLayout();
        let tabEntry = {
            title: tabList[i],
            view: stackLayout
        };
        items.push(tabEntry);
    }
    myTabView.items = items;
    myTabView.on(TabView.selectedIndexChangedEvent, (data: SelectedIndexChangedEventData) => {
        // Some code here
    });
}

Thank you very much.

Dean Le
  • 2,094
  • 13
  • 17
  • 3
    Hi, i think you should declare your "items" array as an Observable Array and bind it to your tabview, then, when an update is done on an item of your observable Array it will automatically update your UI – Kansen Aug 30 '16 at 14:04

0 Answers0