Titanium JIRA Archive
Alloy (ALOY)

[ALOY-1545] Broken Widget event translation. Custom events on Widgets are being applied to the Widget's root View instead of the Widget's Controller itself, causing an error.

GitHub Issuen/a
TypeBug
PriorityCritical
StatusResolved
ResolutionFixed
Resolution Date2017-04-09T05:33:43.000+0000
Affected Version/sn/a
Fix Version/salloy 1.9.11
Componentsn/a
Labelsdefect
ReporterRanando King
AssigneeFeon Sua Xin Miao
Created2017-03-03T18:13:46.000+0000
Updated2017-04-10T17:18:45.000+0000

Description

It only occurs when data binding. *Steps to reproduce:*

Create an app.

Create a widget that triggers an event against its own controller, say "event".

Create a Model.

Add a TableView to index.js

Add a Collection for the model to index.js

Configure the TableView for data binding.

Add a TableViewRow as a template for the databound TableView.

Add the widget to the template TableViewRow using the Alloy tag.

Add an onEvent handler to the widget tag.

Build the app.

*Actual Result:* App throws "*{color:red}undefined is not a function{color}*" error Resources//alloy/controllers/.js shows:
onEvent ? test.getViewEx({
   recurse: true
}).on("event", <yourhandlermethod>) : __defers["test.getViewEx({recurse:true})!event!<yourhandlermethod>"] = true;
*Expected Result:* App runs as expected. Resources//alloy/controllers/.js shows:
onEvent ? test.on("event", <yourhandlermethod>) : __defers["test!event!<yourhandlermethod>"] = true;

Attachments

FileDateSize
errorDemo.zip2017-03-03T20:50:19.000+00009685212

Comments

  1. Sharif AbuDarda 2017-03-03

    Hello, Attach a sample project for us to test. Thanks.
  2. Ranando King 2017-03-03

    A 10MB limit on file sizes makes it almost impossible to create a package small enough to meet the limit and still be immediately workable when unzipped, especially when you consider that the default /app/assets directory is almost 10MB by itself for an Alloy app. That limit needs to be raised to at least 15MB.
  3. Sharif AbuDarda 2017-03-06

    Hello, Please attach in dropbox and provide the link. Thanks.
  4. Ranando King 2017-03-08

    I've already attached a file: errorDemo.zip. I was merely commenting that the upload limit set on this system is too small considering the size of an unmodified project directory.
  5. Ranando King 2017-03-08

    There are other issues with the templatizing system as well. * attributes like "class" and "onXxxx" cannot be templatized. I understand why that would be true for "class" since that is used by the alloy processor at design-time when the template value is only available at runtime. However, this is not the case for event handlers. Since the template instantiating function just translates " id='test' onEvent='' " code like the description, there's no reason that the event handler translation wouldn't be able to accommodate templates.
  6. Feon Sua Xin Miao 2017-03-15

    PR: https://github.com/appcelerator/alloy/pull/820 Functional testing should follow the reproduce steps listed in the description. The app should launch without error.

JSON Source