Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-13529] iOS: ListView: ListItem property "backgroundImage" not recognized

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionCannot Reproduce
Resolution Date2016-10-04T17:16:59.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS
Labels3.1, backgroundimage, listitem, listview, mobile
ReporterCarter Lathrop
AssigneeHans Knöchel
Created2013-04-09T18:43:27.000+0000
Updated2017-03-31T22:42:55.000+0000

Description

*Problem* When trying to assign a custom backgroundImage to a ListItem, the property is not recognized. *Steps to Reproduce* 1. copy and paste code into app.js 2. download the background images, place into resources folder 3. run code 4. notice listViewRow does not have applied background image
var win = Ti.UI.createWindow({backgroundColor: 'white'});

var plainTemplate = {
    childTemplates: [{                            // Title
            type: 'Ti.UI.Label',     // Use a label for the title
            bindId: 'title',         // Maps to a custom title property of the item data
            properties: {            // Sets the label properties
                color: 'black',
                font: { fontFamily:'Arial', fontSize: '20dp', fontWeight:'bold' },
                left: '10dp', top: 0,
            },
        },
        {                            // Subtitle
            type: 'Ti.UI.Label',     // Use a label for the subtitle
            bindId: 'subtitle',      // Maps to a custom subtitle property of the item data
            properties: {            // Sets the label properties
                color: 'gray',
                font: { fontFamily:'Arial', fontSize: '14dp' },
                left: '10dp', top: '25dp',
            }
        }
    ],
};


var listView = Ti.UI.createListView({
    templates: { 'uncheck': plainTemplate},
    defaultItemTemplate: 'uncheck'
});

var tasks = [
    {id: 'dishes', name: 'Do the Dishes', person: 'Wakko', icon: 'dishes.png'},
    {id: 'doggie', name: 'Walk the Dog', person: 'Dot', icon: 'doggie.png'}
];

var data = [];
for (var i = 0; i < tasks.length; i++) {
    data.push({
        title : { text: tasks[i].name },
        subtitle : { text : tasks[i].person },
        properties : {
            itemId: tasks[i].id,
            backgroundImage: '/rowBg.jpg'
        }
    });
}

var section = Ti.UI.createListSection();
section.setItems(data);
listView.sections = [section];

win.add(listView);
win.open();

Attachments

FileDateSize
app.js2013-04-09T18:43:27.000+00001692
ListViewTests.zip2013-04-11T18:17:44.000+00002158225
rowBg.jpg2013-04-11T18:20:29.000+00001846
rowBg@2x.jpg2013-04-11T18:20:29.000+00003456

Comments

  1. Hans Knöchel 2013-04-11

    Fixed the title (backgroundColor -> backgroundImage).
  2. Carter Lathrop 2013-04-11

    Hans, Is it just me or is your rowBg.jpg just a white rectangle? I tried with a different image and it didn't work but if you could use a more recognizable color as your backgroundImage, I think that would be more helpful. Black or gray maybe? Would you mind attaching the image back here and I will pass along to engineering. Thanks, Carter
  3. Hans Knöchel 2013-04-11

    Hi Carter, The Image-Resources were just replaced with a slide gray background gradiant, thank you! Greets, Hans
  4. Carter Lathrop 2013-04-11

    Thanks Hans, moved to Ti-Mobile. Keep a watch on this ticket for updates. Carter
  5. Hans Knöchel 2016-10-04

    Wow, I opened that ticket in 2013, hehe. Resolving, since the providing use-case (row with background-image) is fixed these days.
  6. Lee Morris 2017-03-31

    Closing ticket as "Cannot Reproduce", if you encounter any further problems please file a new ticket.

JSON Source