Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Create headers in tableview fro SQLite

Hi all

I am having a problem with adding headings in tableview from my database.

I kinda works but leaves a row gap after the header

function getData(){
    data = [];
        var rows = db.execute('SELECT * FROM fav Order by Groupname Asc');

        var Header = null;

        while (rows.isValidRow()) {

                var HeaderName = rows.fieldByName('Groupname');

                    if(Header != HeaderName ){
                            var row = Ti.UI.createTableViewRow({
                            header:rows.fieldByName('Groupname')
                            });
                            Header = HeaderName;
                            data.push(row);
                            rows.next();
                        }

                var businessName = Ti.UI.createLabel({
                    ...other code
                    });    

                var businessMiles = Ti.UI.createLabel({
                    ...other code
                    });

                var row = Ti.UI.createTableViewRow({
                    ... other code
                });

            row.add(businessName);
            row.add(businessMiles);
            data.push(row);
            rows.next();        
        }
        rows.close();

    tableView.setData(data);
}

anyone know why i might get a gap after the header?

Thanks

— asked July 15th 2010 by Mark Pierce
  • database
  • headers
  • iphone
  • tableview
0 Comments

0 Answers

The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.