Created
March 20, 2012 08:24
-
-
Save iskugor/2132818 to your computer and use it in GitHub Desktop.
ZenTi demo - extending TableView
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ZenTi makes doing things like this: http://developer.appcelerator.com/question/134097/commonjs-methodology-how-to-access-inner-object-functions | |
// easy and intuitive task | |
// skipped "require" part ... | |
function TableViews(){ | |
} | |
extend(TableViews, TableView); | |
TableViews.prototype.createMyRows = function(data){ | |
var rows =[]; | |
for(var i=0; i<data.length; i++){ | |
rows.push(new TableViewRow(data[i]); | |
} | |
return rows; | |
}; | |
TableViews.prototype.update = function(rowsData){ | |
var rows = this.createMyRows(rowsData); | |
this.appendRows(rows); | |
}; | |
module.exports = TableViews; | |
//somewhere | |
//no worry about creating instance of Titanium's TableView | |
var myTableView = new TableViews(); //typeof - [object Object] | |
myTableView.hasOwnProperty('update'); //true | |
myTableView.hasOwnProperty('appendRows'); //false | |
myTableView.upadate(...); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment