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 6104275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:49:24+00:00 2026-05-23T13:49:24+00:00

We have a sample app that loads 10 records each from the db and

  • 0

We have a sample app that loads 10 records each from the db and shows in a table vioew. The next ten records are taken when the scroll reaches the bottom (like the sample of dynamic scroll view in kitchen sink and following the same sample code). However the app scrolling becomes slower and slower when the no of records increases and then crashes when we were showing close to 1000th record. We have even more records to show (10000) and all the rows shows an 50X50 image and two texts.

if (search.value != null && search.value != ''){
    dbrows = db.execute('select id, name, scientificname from siteRecords where name            like \'%' + search.value + '%\' order by commonname limit 10 offset ' + lastRow);
}else{
    dbrows = db.execute('select id, name, scientificname from siteRecords order by name    limit 10 offset ' + lastRow);
}

tsEnd = new Date;
var duration = tsBegin.getTime() - tsEnd.getTime();
perfTableView.appendRow({title:"To fetch the record from 0 to " + (lastRow + 20) + " took: " + duration + " ms"});

tsBegin = new Date;
var rowCount = 0;
while (dbrows.isValidRow()) {
    var row;

    if( dbrows.fieldByName('name')[0] != curheader || initHeader == 0){
        initHeader = 1;
        curheader = dbrows.fieldByName('name')[0];
        row = Ti.UI.createTableViewRow({height:55,backgroundColor:'#ffffff',backgroundSelectedColor:'#eeee33',hasChild:true,className:'birds',header:curheader});
        index.push({title:curheader,index:rowNumber });
    } else {
        row = Ti.UI.createTableViewRow({height:55,backgroundColor:'#ffffff',backgroundSelectedColor:'#eeee33',hasChild:true,className:'birds'});
    }

    var lblBirdID = Ti.UI.createLabel({
        text: dbrows.fieldByName('id'),
        color: '#000000',
        textAlign:'left',
        left:4,
        top:8,
        height:100,
        font:{fontWeight:'bold',fontSize:10},
        visible:false
    });
    row.add(lblBirdID);

    media = dbrows.fieldByName('scientificname').replace(' ', '_') + '.jpg';
    var path = Titanium.Filesystem.resourcesDirectory + 'Birds/images/'

    if (Titanium.Filesystem.getFile(path,media).exists())
    {
        var f;

        if (isAndroid){
            f = '../images/' + media;
        }else{
            f = Ti.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory,'Birds/images/' + media);
        }

        var imgBird = Ti.UI.createImageView({
            image:f,
            left:4,
            height:50,
            width:50
        });
        row.add(imgBird);
    }else{
        var f;

        if (isAndroid){
            f = '../images/no_bird.jpg';
        }else{
            f = f = Ti.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory,'Birds/images/no_bird.jpg');
        }

        var imgBird = Ti.UI.createImageView({
            image:f,
            left:4,
            height:50,
            width:50
        });
        row.add(imgBird);
    }

    var lblBirdName = Ti.UI.createLabel({
        text: dbrows.fieldByName('name'),
        color: '#000000',
        textAlign:'left',
        left:60,
        top:8,
        height:20,
        font:{fontWeight:'bold',fontSize:16}
    });
    row.add(lblBirdName);

    var lblBirdScientificName = Ti.UI.createLabel({
        text: dbrows.fieldByName('scientificname'),
        color: '#000000',
        textAlign:'left',
        left:60,
        top:26,
        height:20,
        font:{fontSize:11}
    });
    row.add(lblBirdScientificName);

    birdRows[rowNumber] = row;
    rowCount = rowCount + 1;
    rowNumber = rowNumber + 1;
    dbrows.next();
}
dbrows.close();
db.close();

if (rowCount == 20){
    lastRow = lastRow + 20;
}else{
    lastRow = lastRow + rowCount;
}

birdTableView.setData(birdRows);
birdTableView.index = index;

tsEnd = new Date;
duration = tsBegin.getTime() - tsEnd.getTime();
perfTableView.appendRow({title:"To loop through the DB rows and to create table rows took: " + duration + " ms"});

}

  • 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-23T13:49:25+00:00Added an answer on May 23, 2026 at 1:49 pm

    Have you tried unloading items at the top, as items are added to the bottom (and vice versa)? Doing something like this would mean there are never more than say 100 rows at any one time.

    Also, if possible, use a standard row instead of a custom row. A standard row is MUCH more performant than a custom one.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a sample application on http://github.com/niklassaers/Test-iPhone-TabBar-App that shows my problem: I have a
I have a simple iphone app that's based on the CrashLanding sample app. So
I have a very simple iPhone app that requires a random integer from 1-100.
I currently have a simple iPhone app that loads a custom subclass of UIView.
I have a .NET 2.0 app (using C#) that shows some dynamically constructed HTML
I have a simple html/javascript based Android app that loads with the following code:
simple example of the problem: i have an app that can download backgrounds from
This is a real newbie question. I have simple app that selects a picture
I have a simple app that uses an SQL Express 2005 database. When the
Right so I have a simple app that consists of a calendar a Set

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.