Search code examples
appceleratorappcelerator-alloy

Alloy 1.8.3 transform issues after upgrade / possible new bug?


I have found 2 issues that relate to the upgrade of Alloy to 1.8.3, I think both are a part of another bug thats been reported regarding transform and data binding, https://jira.appcelerator.org/browse/ALOY-1477

I didn't want to just report it as a bug incase its down to something i'm doing??

1st one, I originally was referencing alloy_id in the transform for a list but that started produced an error saying alloy_id could not be found, changing it to $model works but not sure if thats how we are supposed to do it now or its part of the above bug?

xml code (part)

<TableViewRow id="categoriesRow" UCATID="{UCATID}" 
            ParentID="{ParentID}" CategoryID="{CategoryID}" catName=    {catName}" 
            model="$model" hasDetail="{hasDetail}">
        <!-- TableViewRow id="categoriesRow" UCATID="{UCATID}" 
            ParentID="{ParentID}" CategoryID="{CategoryID}" catName="{catName}" 
            model="{alloy_id}" hasDetail="{hasChildren}"-->
            <Label id="rowTitle">{CategoryName}</Label>
        </TableViewRow>

The 2nd one is that setting the hasDetail to true or false (a boolean) for a table row to show there is more detail, this works on the iOS app by displaying the little icon fine in all versions so far, however before the upgrade, validating the reference as a boolean worked, but now you have to reference it as a string this can't be right??

controller.js code

function transformFunction(model) {
   var transform = model.toJSON();
   transform.catName = transform.CategoryName;
   transform.hasDetail = transform.hasChildren == "0" ? false : true;
   return transform;
}

$.winProdCats.addEventListener('click', function(e) {
   Ti.API.info('e.row.hasDetail: ' + e.row.hasDetail );
   var iHaveBoolean = e.row.hasDetail;
   Ti.API.info('iHaveBoolean: ' + iHaveBoolean );
  //if(e.row.hasDetail){ //this don't work as a boolean anymore only as a string
    if(iHaveBoolean == "true"){
      parentID = e.row.CategoryID;
      getData();
      filterFunction(library);
      updateUI();
    } else {
      Ti.App.fireEvent('app:products:category:selected', {
          UCATID : e.row.UCATID,
          catName : e.row.catName,
          ParentID : e.row.ParentID,
          CategoryID : e.row.CategoryID
      });
      Alloy.Globals.navGroup.closeWindow($.winProdCats);
    }
});

Solution

  • an error saying alloy_id could not be found

    This is ALOY-1477, fixed in Alloy 1.8.4

    //if(e.row.hasDetail){ //this don't work as a boolean anymore only as a string

    This is ALOY-1480, fix to be merged for Alloy 1.8.x next week, shipping with AppC CLI 5.3.0 end of April