Titanium Community Questions & Answer Archive

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

Multiple Selection from a list

Hi All,
I am having some problem to get a multiple selection list to be rendered with the some custom list elements. Is there any way to accomplish this for Appcelerator Android Application.

— asked May 4th 2010 by Amit Srivastava
  • android
  • list
  • multis4elect
0 Comments

1 Answer

  • I'm aware that this was asked over a year ago, however I had the same problem and since this post came up in my search I thought I'd provide an answer.

    below is a simplified version of code to produce a list capable of multiple selections.

    win.add(sizeTable = Ti.UI.createTableView({allowSelection:true}))
    
    data = [
        {title:'X small',     selected:false, backgroundColor:'#fff'},
        {title:'small',     selected:false, backgroundColor:'#fff'},
        {title:'medium',     selected:false, backgroundColor:'#fff'},
        {title:'large',     selected:false, backgroundColor:'#fff'},
        {title:'X large',     selected:false, backgroundColor:'#fff'},
        {title:'XX large',     selected:false, backgroundColor:'#fff'}
    ]
    
    sizeTable.data = data
    
    sizeTable.addEventListener('click',function(e){
        e.rowData.selected = !e.rowData.selected
        if(e.rowData.selected){
            e.rowData.backgroundColor = "#64b1fc"
        } else {
            e.rowData.backgroundColor = "#fff"
        }
    })
    

    I'm assuming thats the kind of thing the original poster was after…

    — answered July 26th 2011 by Stuart Hicks
    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.