Search code examples
appceleratorappcelerator-titaniumappcelerator-alloy

Appcelerator - Add widget into tableviewrow


I have a tableView and I want to add a widget into a tableViewRow by code in the js file.

My widget is called: "es.comboBox" (I'm using it in other controllers and it works perfectly, but I'm creating it at xml file).

This is my code:

index.xml

...
<TableViewRow id="row_subseccion" layout="vertical"</TableViewRow>
...

index.js

var widget = Alloy.createWidget("es.comboBox", {
    choices: subsecciones,
    value: -1
});

$.row_subseccion.add(widget);

The error is: (The error appears when the program is executing the add instruction)

libc: Fatal signal 11 (SIGSEGV) at 0x76616a64 (code=1), thread 5058 (KrollRuntimeThr)

What I'm doing wrong? Thank you.

This works, but I need to add it after an action from the user.

<TableViewRow id="row_subseccion" layout="vertical">
        <Widget src="es.comboBox" class="selectField" id="subseccion"></Widget>
</TableViewRow>

Solution

  • The widget var holds the actual Alloy Controller of the widget, not the view you can add to the row. Please change to:

    $.row_subseccion.add(widget.getView());