Titanium Community Questions & Answer Archive

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

tableView index Event problem

Hi,

I'm working on a table view, and want to add an Index (the little bar in rightside with vertical swipe)

Took KitchenSink sample, it dosen't work (in KitchenSink, and my project) : the index appear, but make no swipe

I think there is an Event Listener somewhere, but can't find it….

Thanks for your Help !!!

Here is my code :


var tableSocOptions = {
    data : dataSoc,
    separatorStyle:Ti.UI.iPhone.TableViewSeparatorStyle.NONE,
    rowBackgroundColor : 'white'

};

var tableSoc = Titanium.UI.createTableView(tableSocOptions);

var indexSoc = [
{title:'A',index:0},
{title:'B',index:16},
{title:'C',index:25}
]

tableSoc.index = indexSoc;


this is the strict implementation of KitchenSink, and i don't see the event listener for make the vertical Swipe.

Actually, clicking on the index in my table just rewind my list in the top….

— asked June 28th 2010 by Vivien Brissat
  • index
  • kitchensink
  • tableview
0 Comments

2 Answers

  • I just realize that i have no Header in my rows, and index is linked with Header in rows.

    But this is a little confusing, because in index we put index Objects with Title AND index row position….

    SO i think you may want to put in documentation that you need Header for make index…

    ;)

    — answered June 28th 2010 by Vivien Brissat
    permalink
    1 Comment
    • ya, what is it here? I cant get this to work either. And nothing in docs saying what can be used in the dictionary for TableView.data property. When I click the index, it just turns grey .. for a moment

      — commented September 25th 2013 by Brian Burgess
  • ok I got this by setting an empty 'header' property for each item in the data object passed into the TableView.data property. Like:


    while (words.isValidRow()) {
    retval.push({title:words.fieldByName('eng_word'), header:''});
    words.next();
    }
    words.close();
    return retval;


    Where 'words' is a SQLite recordset.

    The TableView.index is set with a function shown below:


    function makeTableIndex() {
    var retval = null;
    retval = [ {title:' ',index:1}, {title:' ',index:2},
    {title:'A',index:75}, {title:'C',index:194}, {title:'E',index:365},
    {title:'G',index:467}, {title:'I',index:532}, {title:'K',index:562},
    {title:'M',index:626}, {title:'P',index:751}, {title:'R',index:826},
    {title:'S',index:869}, {title:'U',index:1056}, {title:'W',index:1091},
    {title:'Z',index:1136} ];

    }
    return retval;
    

    }


    This displays the table properly (without any separators between any of the rows). And the index on the right of the TableView functions properly as well.

    — answered September 25th 2013 by Brian Burgess
    permalink
    0 Comments
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.