[TIMOB-1319] [PATCH] Class cast exception in TableViewRowProxy.java in fireEvent
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Trivial |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-04-17T01:55:51.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 1.4.0 |
Components | Android |
Labels | android, defect, tableview |
Reporter | Joel Boehland |
Assignee | Don Thorp |
Created | 2011-04-15T02:49:15.000+0000 |
Updated | 2011-04-17T01:55:51.000+0000 |
Description
TableViewRowProxy.fireEvent assumes that its parent is a TableViewProxy, when it can also be a TableViewSectionProxy object. If you fire an event from a row contained in a TableViewSection, it will cause a ClassCastException to be raised and the app will die. The following changes in my local repo fixed the problem:
diff --git
a/android/modules/ui/src/ti/modules/titanium/ui/TableViewRowProxy.java
b/android/modules/ui/src/ti/modules/titanium/ui/TableViewRowProxy.java
index a415c32..f1842db 100644
---
a/android/modules/ui/src/ti/modules/titanium/ui/TableViewRowProxy.java
+++
b/android/modules/ui/src/ti/modules/titanium/ui/TableViewRowProxy.java
@@ -87,8 +87,14 @@ public class TableViewRowProxy extends
TiViewProxy
@Override
public boolean fireEvent(String eventName, TiDict data) {
if (eventName.equals("click")) {
-
TableViewProxy table = null; // inject row click data for events coming from row children
-
TableViewProxy table = (TableViewProxy)getParent();
-
if(getParent() instanceof TableViewProxy) {
-
table = (TableViewProxy)getParent();
-
}
-
if(getParent() instanceof TableViewSectionProxy) {
-
table = (TableViewProxy)getParent().getParent();
-
} Item item = tableViewItem.getRowData(); if (table != null && item != null) { TableViewModel model = table.getTableView().getModel();
Attachments
File | Date | Size |
---|---|---|
gdiff.txt | 2011-04-15T02:49:15.000+0000 | 1154 |
Apologies for the badly-formatted patch that I inlined in the original message. Please see the attached patch instead.
(from [c580ff0f0ed719c35f65a7db75236540b7d8b187]) go up the tree to find the row's TableView parent (sometimes the immediate parent is a section) [#1319 state:resolved] http://github.com/appcelerator/titanium_mobile/commit/c580ff0f0ed719c35f65a7db75236540b7d8b187"> http://github.com/appcelerator/titanium_mobile/commit/c580ff0f0ed71...