Alloy 1.8.3 升级后的转换问题/可能的新错误?
Alloy 1.8.3 transform issues after upgrade / possible new bug?
我发现了 2 个与 Alloy 升级到 1.8.3 相关的问题,
我认为两者都是关于转换和数据绑定的另一个错误的一部分,https://jira.appcelerator.org/browse/ALOY-1477
我不想仅仅将它作为一个错误来报告,以防它归结为我正在做的事情??
第一个,我最初是在列表的转换中引用 alloy_id
但这开始产生了一个错误,说 alloy_id 找不到,将其更改为 $model 有效但不确定我们现在应该如何做还是它是上述错误的一部分?
xml代码(部分)
<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>
第二个是将 table 行的 hasDetail 设置为 true 或 false(布尔值)以显示更多细节,这在 iOS 应用程序上通过显示小到目前为止所有版本的图标都很好,
但是在升级之前,将引用验证为布尔值有效,但现在您必须将其作为字符串引用
这不可能吧??
controller.js代码
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);
}
});
我发现了 2 个与 Alloy 升级到 1.8.3 相关的问题, 我认为两者都是关于转换和数据绑定的另一个错误的一部分,https://jira.appcelerator.org/browse/ALOY-1477
我不想仅仅将它作为一个错误来报告,以防它归结为我正在做的事情??
第一个,我最初是在列表的转换中引用 alloy_id 但这开始产生了一个错误,说 alloy_id 找不到,将其更改为 $model 有效但不确定我们现在应该如何做还是它是上述错误的一部分?
xml代码(部分)
<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>
第二个是将 table 行的 hasDetail 设置为 true 或 false(布尔值)以显示更多细节,这在 iOS 应用程序上通过显示小到目前为止所有版本的图标都很好, 但是在升级之前,将引用验证为布尔值有效,但现在您必须将其作为字符串引用 这不可能吧??
controller.js代码
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);
}
});