Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6872087
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:53:02+00:00 2026-05-27T03:53:02+00:00

im using for first time appcelerator for a Iphone app, im using a TableViewRow,

  • 0

im using for first time appcelerator for a Iphone app, im using a TableViewRow, when the window load all is fine, but if i want to refresh the window, the TableViewRow repeat the same data every time that i push refresh, so, i have 5 Categories, after refresh im having the same Categories repeting every time that im trying to refresh.

Ti.UI.backgroundColor = '#dddddd';

var url = "http://remoteJSON.js";
var win = Titanium.UI.currentWindow;
var table = Titanium.UI.createTableView();
var tableData = [];
var json, categorias, categoria, i, row, categoriaLabel, descripcionLabel;

var refreshBtn = Titanium.UI.createButton({
    systemButton: Ti.UI.iPhone.SystemButton.REFRESH
});

refreshBtn.addEventListener('click', function() {
    loadTutoriales();
});

win.setRightNavButton(refreshBtn);


var actInd = Titanium.UI.createActivityIndicator({
    bottom:10, 
    height:50,
    width:10,
    style:Titanium.UI.iPhone.ActivityIndicatorStyle.PLAIN
});

function loadTutoriales(){

    if(!Titanium.Network.online){
         alert("Debe conectarse a internet.");
    } 

    var xhr = Ti.Network.createHTTPClient({

        onload: function() {
        actInd.show();
        actInd.message = 'Loading...'; 


        //Ti.API.debug(this.responseText);

        json = JSON.parse(this.responseText);
        for (i = 0; i < json.categorias.length; i++) {

                var rowColor = '#eeeeee';
                if(i & 1){
                    rowColor = '#ffffff';
                }


                categoria = json.categorias[i];

                var row = Ti.UI.createTableViewRow({
                    height:'auto',
                    hasChild:true
                });

                row.backgroundColor=rowColor;


                /* add */
                var post_view = Titanium.UI.createView({
                        height:'auto', 
                        layout:'vertical',
                        top:5,
                        right:5,
                 bottom:5,
                 left:5
            });

                var av_image = Titanium.UI.createImageView({
                        image:categoria.imageUrl, 
                        top:0,
                        left:0,
                        height:48,
                        width:48
                });
                post_view.add(av_image);

                var inner_view = Titanium.UI.createView({
                    height:'auto',
                    layout:'vertical', 
                    top:0,          
                    right:0,
                    bottom:0,
                    left:0
                });

               /* end add */

                var categoriaLabel = Ti.UI.createLabel({
                    text:categoria.categoryName,
                    left:54,
                    width:120,
                    top:-48,
                    bottom:0,
                    height:18,
                    textAlign:'left',
                    color:'#444444',
                    font:{fontFamily:'Trebuchet MS',fontSize:14,fontWeight:'bold'}
                });
                inner_view.add(categoriaLabel);

                var descripcionLabel = Ti.UI.createLabel({
                    text:'"' + categoria.description + '"',
                    left:54,
                    top:0,
                    bottom:2,
                    height:'auto', 
                    width:'auto',
                    textAlign:'left',
                    font:{fontSize:14}
                });
                inner_view.add(descripcionLabel);
                post_view.add(inner_view);

                row.add(post_view);
                //row.add(descripcionLabel);
                tableData.push(row);
            }

            table.setData(tableData); 
        },
        onerror: function(e) {
            Ti.API.debug("STATUS: " + this.status);
            Ti.API.debug("TEXT:   " + this.responseText);
            Ti.API.debug("ERROR:  " + e.error);
            alert('There was an error retrieving the remote data. Try again.');
        },
        timeout:5000

    });

        //win.add(actInd);
    win.add(table);
    win.open();
        //actInd.hide();
    xhr.open("GET", url);
    xhr.send();
}
loadTutoriales();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T03:53:03+00:00Added an answer on May 27, 2026 at 3:53 am

    When you press the refresh button clear the tableData array and assign to table set data function before you fill your table again. So it will empty your table first and than fill new refreshed data.

    Like this,

    refreshBtn.addEventListener('click', function() {
        tableData = [];
        table.setData(tableData);
        loadTutoriales();
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using cobertura first time. Everything works fine but what I wonder is,
I am using JSON for first time... and want to fill my datagrid with
Problem on WindowsXP (likely will happen on all Win installs), first time using Mercurial.
first time posting here. I'm using a loop to create 3 buttons, but my
This is my first time using a JFrame. I can't get the window to
I'm using the first time regex and I want to split a string in
Its my first time using modal windows. And I'm currently using fancy box. But
this is my first time using SQL at all, so this might sound basic.
First time using RewriteRule, so I made RewriteRule ^details/(.*)/(.*)$ /details.php?id=$1&name=$2 [NC] but there are
First time using JSF, and I'm sort of confused about how getRowData() works. All

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.