dynamic adding of tableviewrows into sections

You must Login before you can answer or comment on any questions.

Hi, in my project I want to insert and update rows in sections.

Constructor:

var self = require('/modules/l2g').create(title);
self.mytableview = Ti.UI.createTableView({});
self.add(self.mytableview);
self.favchannelsection = require('/modules/parts/section').create('Kanäle');
self.favvideossection = require('/modules/parts/section').create('Videos');
self.recentsvideossection = require('/modules/parts/section').create('Videos');
self.mytableview.setData([self.favchannelsection,self.favvideossection,self.recentsvideossection]);
Updater/inserter:
Ti.App.addEventListener('favs_changed', function(data) {
    var rows = [];
    var favs = data.favs;
    var length = favs.length;
    for (var i = 0; i < length; i++) {
        rows[i] = Ti.UI.createTableViewRow({
                backgroundColor : '#fff',
                hasChild : true,
                kanal : favs[i]
        });
        self.favchannelsection.add(rows[i]);
    }
));
But the section leaves empty. In documentation I found the suggestion to use appendRow() as add(). If I use appendRow(), then an error appears:
Script Error = 'undefined' is not a function (evaluating 'self.favchannelsection.appendRow(rows[i])') at mylecture2go.js (line 39).
I have no ideas.

Rainer

2 Answers

Your Answer

Think you can help? Login to answer this question!