Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

showing last added data first in titanium database

$
0
0

I'm posting this question which appears not to have been answered before. I want to show last added data first in tableview row.how is it possible?

var db = Titanium.Database.open('abc');
 
    var rows = db.execute('select * from abctable');
 
    while (rows.isValidRow())
    {
 
        var row = Ti.UI.createTableViewRow({
            haschild: true,
       });
        var title = Ti.UI.createLabel({ 
            color:'#000000',
            height:32,
            left:5,
            top:2,
            font:{fontSize:'18dp',fontWeight:'bold' },
            backgroundColor:'transparent',
            text:'' + rows.fieldByName('category') + ''
        });
        var address = Ti.UI.createLabel({   
            color:'#000000',
            height:32,
            left:5,
            top:34,
            fontSize:'14dp',
            backgroundColor:'transparent',
            text:'' + rows.fieldByName('abc') + ''
        });
         row.add(title);
        row.add(address);
          data.push(row);
           rows.next();     
 
    }
        rows.close();
 
 
 
    // create table view
    var tableview = Titanium.UI.createTableView({
        data:data
    });
 
    // create table view event listener
    tableview.addEventListener('click', function(e) {
 
    });
 
    // add table view to the window
    self.add(tableview);
 
            db.close();

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>