0

I want to console log all label text value displayed from my xml, And this is how I was doing to log the label Ti.API.info($.label.getText()); , but this code doesn't seem to work since this only works for only a single value from a variable. How I'm going to do this? Sorry,Just so noob enough. Thanks!

<TableView id="table" dataCollection="person">
   <TableViewRow id="row">
     <Label id="label" text="{name}"></Label>
   </TableViewRow>
</TableView>
Rh Jov
  • 115
  • 1
  • 11
  • 2
    people in this community are helpful, but it is good practice to respond and/or accept answers before asking more http://stackoverflow.com/questions/17419483/titanium-delete-tableviewrow-model-view-binding-should-automatically-reflect-ta/17425253#comment25332406_17425253 – Aaron Saunders Jul 04 '13 at 13:28

1 Answers1

2

from the Appcelerator documentation http://docs.appcelerator.com/titanium/latest/#!/guide/Alloy_Data_Binding

dataTransform: specifies an optional callback to use to format model attributes. The passed argument is a model and the return value is a modified model as a JSON object.

<TableView id="table" dataCollection="person" dataTransform="dumpText" >
   <TableViewRow id="row">
     <Label id="label" text="{name}"></Label>
   </TableViewRow>
</TableView>

So we can use this method to dump whatever is being added to the list

function dumpText(model) {
    // model to a JSON object
    var o = model.toJSON();
    Ti.API.info(o.name);
    return o;
}
Aaron Saunders
  • 31,625
  • 5
  • 54
  • 74