问题描述
限时送ChatGPT账号..我有钛的 tableview.我在 3 个不同的行中显示了 12 个标签.当我第一次使用它时,它正确地显示了所有 3 行的内容.
I have tableview in titanium.I have displayed 12 labels in 3 different rows.When i am using it first time it is showing all of the 3 rows properly with content.
每当我从 tableview 返回到其他视图并再次访问同一个 tableview 时,我看不到 tableview 内容,我只能看到空白行.
Whenever i am coming back from the tableview to other view and again i am going to access the same tableview, i can not see tableview content, i can only see blank rows.
任何人都可以帮我解决问题,到底是什么问题,以及为什么在加载 tableview 时我无法再次看到内容(第二次).
can anybody help me out , what exactly the problem is and why am i not able to see content again(2nd time) when tableview loads.
我在下面添加了完整的代码片段:
I have added whole code snippet below :
var win = Titanium.UI.currentWindow;
var atmData =[];
var tableView;
var titledata =[
'Member No:',
'A/C Type:',
'A/C Desc:',
'A/C: ',
'State:',
'Zip:',
'Surcharge\nAmount:',
];
var Value =[
'28956',
'Savings',
'85416',
'025489',
'California',
'38847',
'Free',
];
var FirstLabel =[];
var FirstText = [];
var SecondLabel =[];
var SecondText = [];
var ThirdLabel =[];
var ThirdText = [];
var FourthLabel =[];
var FourthText = [];
var FifthLabel =[];
var FifthText = [];
var SixthLabel =[];
var SixthText = [];
for (var i=0; i < 3; i++){
var row = Ti.UI.createTableViewRow();
//row.backgroundColor = '#576996';
row.selectedBackgroundColor = '#385292';
//row.height = 170;
FirstLabel = Titanium.UI.createLabel({
text:'Member No:',
color:'black',
//textAlign:'left',
//font:{fontSize:13,fontWeight:'bold'},
font:{fontSize:13,
fontFamily:'Helvetica Neue'
},
width: 110,
left:10,
height:20,
top :0
});
FirstText = Titanium.UI.createLabel({
text:'35687',
color:'black',
//textAlign:'left',
//font:{fontSize:13,fontWeight:'bold'},
font:{
fontSize:13,
fontFamily:'Helvetica Neue'
},
width:'auto',
height:20,
left:120,
top :0
});
SecondLabel = Titanium.UI.createLabel({
text:'A/C Type:',
color:'black',
//textAlign:'left',
//font:{fontSize:13,fontWeight:'bold'},
font:{fontSize:13,
fontFamily:'Helvetica Neue'
},
width: 100,
height:20,
left:10,
top :25
});
SecondText = Titanium.UI.createLabel({
text:'Savings',
color:'black',
//textAlign:'left',
//font:{fontSize:13,fontWeight:'bold'},
font:{
fontSize:13,
fontFamily:'Helvetica Neue'
},
width:'auto',
height:20,
left:120,
top :25
});
ThirdLabel = Titanium.UI.createLabel({
text:'A/C Desc:',
color:'black',
//textAlign:'left',
//font:{fontSize:13,fontWeight:'bold'},
font:{fontSize:13,
fontFamily:'Helvetica Neue'
},
width: 100,
height:20,
left:10,
top :50
});
ThirdText= Titanium.UI.createLabel({
text:'65565616',
color:'black',
//textAlign:'left',
//font:{fontSize:13,fontWeight:'bold'},
font:{
fontSize:13,
fontFamily:'Helvetica Neue'
},
width:'auto',
height:20,
left:120,
top :50
});
FourthLabel = Titanium.UI.createLabel({
text:'A/C:',
color:'black',
//textAlign:'left',
//font:{fontSize:13,fontWeight:'bold'},
font:{fontSize:13,
fontFamily:'Helvetica Neue'
},
width: 100,
height:20,
left:10,
top :75
});
FourthText= Titanium.UI.createLabel({
text:'861556.00',
color:'black',
//textAlign:'left',
//font:{fontSize:13,fontWeight:'bold'},
font:{
fontSize:13,
fontFamily:'Helvetica Neue'
},
width:'auto',
height:20,
left:120,
top :75
});
FifthLabel = Titanium.UI.createLabel({
text:'ZIP :',
color:'black',
//textAlign:'left',
//font:{fontSize:13,fontWeight:'bold'},
font:{fontSize:13,
fontFamily:'Helvetica Neue'
},
width: 100,
height:20,
left:10,
top :100
});
FifthText= Titanium.UI.createLabel({
text:'388546',
color:'black',
//textAlign:'left',
//font:{fontSize:13,fontWeight:'bold'},
font:{
fontSize:13,
fontFamily:'Helvetica Neue'
},
width:'auto',
height:20,
left:120,
top :100
});
SixthLabel = Titanium.UI.createLabel({
text:'Surcharge\nAmount:',
color:'black',
//textAlign:'left',
//font:{fontSize:13,fontWeight:'bold'},
font:{fontSize:13,
fontFamily:'Helvetica Neue'
},
width: 100,
height:50,
left:10,
top :125
});
SixthText= Titanium.UI.createLabel({
text:'Free',
color:'black',
//textAlign:'left',
//font:{fontSize:13,fontWeight:'bold'},
font:{
fontSize:12,
fontFamily:'Helvetica Neue'
},
width:'auto',
height:50,
left:120,
top :125
});
row.className = 'header';
row.add(FirstLabel);
row.add(FirstText);
row.add(SecondLabel);
row.add(SecondText);
row.add(ThirdLabel);
row.add(ThirdText);
row.add(FourthLabel);
row.add(FourthText);
row.add(FifthLabel);
row.add(FifthText);
row.add(SixthLabel);
row.add(SixthText);
atmData.push(row);
backgroundColor:'transparent'
};
var tableview = Titanium.UI.createTableView({
data:atmData,
rowHeight:170,
});
win.add(tableview);
推荐答案
我有一个非常相似的问题,我可以通过将 tableview.setData(tableview.data);
放入任何事件中来解决这个问题这导致表格看起来很奇怪.
I had a very similar problem that I was able to fix by putting tableview.setData(tableview.data);
into any events that caused the table to look strange.
这篇关于如何解决 Titanium TableView 显示问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论