1
鈦Appcelerator的 無法對下面的按鈕點擊更新列表視圖代碼內的文本:更新文本上itemClick在鈦Appcelerator的
{
type : 'Ti.UI.View',
bindId : 'vwqtySelection',
properties : {
top : '30dp',
height : '50dp',
//backgroundColor: 'red',
width : require('main').XhdpiSupport(150),
right : '90dp',
zIndex : 10
},
childTemplates : [{
type : 'Ti.UI.Button',
bindId : 'btnMinus',
properties : {
left : '15dp',
color : '#676972',
title : '-',
width : require('main').XhdpiSupport(30),
height : require('main').XhdpiSupport(22),
}
}, {
type : 'Ti.UI.Label',
bindId : 'qtyValue',
properties : {
//touchenabled : false,
left : '50dp',
color : '#676972',
text : '4',
textAlign : 'center',
}
}, {
type : 'Ti.UI.Button',
bindId : 'btnPlus',
properties : {
left : '79dp',
color : '#676972',
title : '+',
}
}]
}
>項目單擊選擇在哪裏更新按鈕,點擊文字 要更新上按鈕文本點擊即4至2
下面代碼我試圖
scrlView.addEventListener('itemclick', function(e) {
if (e.bindId === 'btnMinus') {
item = section.getItemAt(e.itemIndex);
e.section.qtyValue.properties.text = "2";
e.section.updateItemAt(e.itemIndex, item);
//here not able to update text 4 to 2
} else if (e.bindId === 'btnPlus') {
}
}};
誤差得到下面 消息:未捕獲的類型錯誤:無法的未定義
我不明白你的代碼,你如何使用列表視圖以及上面的代碼究竟是做什麼的?無論如何,要更新列表項目中的字段,最簡單的方法是獲取該項目,編輯它,然後在列表視圖中更新它,只需解釋一點你的代碼,我會幫助的,我將添加一個合金如何在'listView'中編輯標籤的例子。 – Zabady