[TIMOB-11629] TiAPI: TableView getRowByName
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Medium |
Status | Closed |
Resolution | Won't Fix |
Resolution Date | 2014-02-21T01:04:00.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | TiAPI |
Labels | n/a |
Reporter | Martin Guillon |
Assignee | Vishal Duggal |
Created | 2012-10-10T09:16:47.000+0000 |
Updated | 2017-03-22T17:29:55.000+0000 |
Description
As we have a getRowIndexByName (which by the way is not documented),
I thought it would be a great idea to simply have a getRowByName that directly returns the rows so that you can interact with it.
In the test case i use it in a click event, which is dumb as you already have e.row, but it s very useful in more complex cases.
var win = Titanium.UI.createWindow();
win.backgroundColor = '#ccc';
var tableview = Ti.UI.createTableView();
win.add(tableview);
var rowData = [];
for (var i = 0; i < 10; i++) {
var row = Ti.UI.createTableViewRow({
title : 'row ' + i,
name : 'row ' + i
});
rowData.push(row);
};
tableview.data = rowData;
tableview.addEventListener('click', function(e) {
if (e.row) {
Ti.API.info(JSON.stringify(e.row))
var row = tableview.getRowByName(e.row.name);
alert('click on row with name "' + e.row.name + '" and the getRowByName return a row with name "' + row.name + '"')
}
})
win.open();
pull request https://github.com/appcelerator/titanium_mobile/pull/3148
We are not currently adding new features to TableView. Thank you for the request and the code submission. If people wish to add this functionality, they are welcome to merge the code from the PR.
Closing ticket as the issue will not fix and with reference to the above comments.