如何解决 Titanium TableView 显示问题?

编程入门 行业动态 更新时间:2024-10-07 13:23:19
本文介绍了如何解决 Titanium TableView 显示问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送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:关键词]

本文发布于:2023-05-01 11:06:53,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1408606.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何解决   Titanium   TableView

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!