Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-16679

Android: Links do not work in ListView (e.g. autoLink)

    Details

    • Sprint:
      2014 Sprint 10 SDK, 2014 Sprint 11 SDK

      Description

      ListView does not display the links after scrolling out of screen. Both autoLink and html (text) does not work.

      Example code below. For the example, the first time the app loads google.com link is clickable, upon scrolling out of screen and scrolling back google.com becomes no longer clickable.

      var self = Ti.UI.createWindow({
          backgroundColor: 'white'
      });
      var myTemplate = {
          childTemplates: [                   // 
              {                            // Title 
                  type: 'Ti.UI.Label',     // Use a label for the title 
                  bindId: 'info',          // Maps to a custom info property of the item data
                  properties: {            // Sets the label properties
                      color: 'black',
                      font: { fontFamily:'Arial', fontSize: '20dp', fontWeight:'bold' },
                      left: '60dp', top: 0,
                      autoLink: Ti.UI.AUTOLINK_ALL
                  }
              },
              {                            // Subtitle
                  type: 'Ti.UI.Label',     // Use a label for the subtitle
                  bindId: 'es_info',       // Maps to a custom es_info property of the item data
                  properties: {            // Sets the label properties
                      color: 'gray',
                      font: { fontFamily:'Arial', fontSize: '14dp' },
                      left: '60dp', top: '25dp',
                      autoLink: Ti.UI.AUTOLINK_ALL
                  }
              }
          ]
      };
       
      var listView = Ti.UI.createListView({
          // Maps myTemplate dictionary to 'template' string
          templates: { 'template': myTemplate },
          // Use 'template', that is, the myTemplate dict created earlier
          // for all items as long as the template property is not defined for an item.
          defaultItemTemplate: 'template'
      });
      var sections = [];
       
      var fruitSection = Ti.UI.createListSection({ headerTitle: 'Fruits / Frutas'});
      var fruitDataSet = [
          // the text property of info maps to the text property of the title label
          // the text property of es_info maps to text property of the subtitle label
          // the image property of pic maps to the image property of the image view
          { info: {html: "<a href='http://en.wikipedia.org/wiki/Apple'>Apple</a>"}, es_info: {text: 'Manzana'}},
          { info: {html: "<a href='http://en.wikipedia.org/wiki/Banana'>Banana</a>"}, es_info: {text: 'Banana'}}
      ];
      fruitSection.setItems(fruitDataSet);
      sections.push(fruitSection);
       
      var vegSection = Ti.UI.createListSection({ headerTitle: 'Vegetables / Verduras'});
      var vegDataSet = [
          { info: {html: 'Carrot'}, es_info: {text: 'Zanahoria'}},
          { info: {html: 'Potato'}, es_info: {text: 'Patata'}}
      ];
      vegSection.setItems(vegDataSet);
      sections.push(vegSection);
       
      var grainSection = Ti.UI.createListSection({ headerTitle: 'Grains / Granos'});
      var grainDataSet = [
          { info: {html: "<a href='http://en.wikipedia.org/wiki/Maiz'>Corn</a>"}, es_info: {text: 'Maiz'}},
          { info: {html: "<a href='http://en.wikipedia.org/wiki/Rice'>Rice</a>"}, es_info: {text: 'Arroz'}},
          { info: {html: "<a href='http://en.wikipedia.org/wiki/Wheat'>Wheat</a>"}, es_info: {text: 'Trigo'}},
          { info: {html: "<a href='http://en.wikipedia.org/wiki/Maiz'>Corn</a>"}, es_info: {text: 'Maiz'}},
          { info: {html: "<a href='http://en.wikipedia.org/wiki/Rice'>Rice</a>"}, es_info: {text: 'Arroz'}},
          { info: {html: "<a href='http://en.wikipedia.org/wiki/Wheat'>Wheat</a>"}, es_info: {text: 'Trigo'}},
          { info: {html: "<a href='http://en.wikipedia.org/wiki/Maiz'>Corn</a>"}, es_info: {text: 'Maiz'}},
          { info: {html: "<a href='http://en.wikipedia.org/wiki/Rice'>Rice</a>"}, es_info: {text: 'Arroz'}},
          { info: {html: "<a href='http://en.wikipedia.org/wiki/Wheat'>Wheat</a>"}, es_info: {text: 'Trigo'}},
          { info: {html: "<a href='http://en.wikipedia.org/wiki/Maiz'>Corn</a>"}, es_info: {text: 'Maiz'}},
          { info: {html: "<a href='http://en.wikipedia.org/wiki/Rice'>Rice</a>"}, es_info: {text: 'Arroz'}},
          { info: {html: "<a href='http://en.wikipedia.org/wiki/Wheat'>Wheat</a>"}, es_info: {text: 'Trigo'}},
      ];
      grainSection.setItems(grainDataSet);
      sections.push(grainSection);
       
      listView.setSections(sections);
           
      self.add(listView);
      self.open();
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                hpham Hieu Pham
                Reporter:
                tanlihao Tan Li Hao
                Reviewer:
                Vishal Duggal (Inactive)
              • Watchers:
                0 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-18510
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Integration