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
Self solved:
After every inserting of rows I forced the rerendering with setData(). Cofe on pastie
Hi
You have a solution, but thought you may not have noticed the 'extras' we gained in the 3.0.0 GA SDK specifically related the tableView. Obviously your product would need to be in 3.0.0 GA to benefit though.
This adds a lot of functionality that will be rather helpful.
Your Answer
Think you can help? Login to answer this question!