[TIMOB-5982] Can't get access to a TableView's rows (Android)
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-01-04T13:10:24.000+0000 |
Affected Version/s | Release 1.7.0, Release 1.8.0 |
Fix Version/s | Sprint 2011-44, Release 1.7.6, Release 1.8.0.1 |
Components | Android |
Labels | data, module_tableviewrow, qe-testadded |
Reporter | Shannon Hicks |
Assignee | Allen Yeung |
Created | 2011-11-03T12:27:59.000+0000 |
Updated | 2012-01-04T13:10:24.000+0000 |
Description
I need to get an array of a TableView's rows. I tried two different ways, but both produce errors. They are in the code below. Please note, that while this code is designed to delete a row, that is not the goal in my usage... I need access to the TableViewRow objects themselves. Both examples work in iOS.
var win = Ti.UI.createWindow();
var myTableView = Ti.UI.createTableView();
var row = Ti.UI.createTableViewRow({
height:80,
backgroundColor:'#c00',
});
myTableView.appendRow(row);
win.add(myTableView);
win.addEventListener('open',function(){
setTimeout(function(){
Ti.API.debug(JSON.stringify(myTableView));
var tableRows = myTableView.data[0].rows;
Ti.API.debug(JSON.stringify(tableRows));
tableRows.pop(); // returns the error org.mozilla.javascript.EcmaError: TypeError: Cannot find default value for object.
myTableView.data = tableRows;
},2000); // two seconds after the window opens, remove the red row
});
/* you can swap out the open event listener with this one to see my alternative also fail
win.addEventListener('open',function(){
setTimeout(function(){
Ti.API.debug(JSON.stringify(myTableView));
var tableRows = myTableView.sections[0].rows; // returns the error Message: Java class "java.util.ArrayList" has no public instance field or method named "0".
Ti.API.debug(JSON.stringify(tableRows));
tableRows.pop();
myTableView.data = tableRows;
},2000); // two seconds after the window opens, remove the red row
});
*/
win.open();
Attachments
File | Date | Size |
---|---|---|
objectType.js | 2011-11-03T14:14:59.000+0000 | 485 |
Shannon, please leave the assignee field to automatic when creating tickets. Many thanks
Android is not returning array when called so error is thrown during compile because of the pop statement. Created a short simple test for drillbit and return type fails
Natalie If you are aware of this issue, you are welcome to take ownership of the ticket and move it to TiMob. Thanks
oh, my apologies - you have done. Thank you! :)
I would try the following workaround to remove a table row:
You can also access a single table row via something like: myTableView.data[0].rows[0]
Fixed on 1_7_X.
Needs to be checked on 1.8.0 after v8 merge.
Looks to have been resolved with V8 changes. I don't believe this patch is required now after v8 merge.
Function test for 1.8.0.1 passed.
Tested with 1.8.0.1.v20111205164258 v8/rhino on Galaxy 10.1 (3.1) Droid 1 (2.2.2) Nexus S (2.3.6) Emulator (4.0)
Open to add label