This is a migrated thread and some comments may be shown as answers.

Listviews with images and text

1 Answer 125 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
assis
Top achievements
Rank 1
assis asked on 18 May 2015, 10:52 AM

<ListView items="{{ menu }}" row="1" itemTap="listViewItemTap" >
      <ListView.itemTemplate>
        <GridLayout columns="auto, *">
          {%raw%}<Image src="{{ imageURL }}" row="0" cssClass="icon"/>{%endraw%}
          <StackLayout col="1">
            <Label text="{{ title || 'Downloading...'}}"  cssClass="name"/>
            <Label text="{{ subtitle }}" cssClass="location"/>
          </StackLayout>
        </GridLayout>
      </ListView.itemTemplate>
 </ListView>

I have this xml file, I want to get a list with a image and a title and subtitle.

in the javascript I have

    for (var i = 0; i < list.length; i++)
    {
        menu.push({
           imageURL : images.imageURL(list[i].icon),
            title: list[i].menu,
            subtitle: list[i].desc
        })
    }

 

where imageURL is:

imageSource.fromUrl(server.address + '/' + path)
                          .then(function (res) {
                              console.log("Image successfully loaded");
                              return res;
                          }, function (error) {
                              console.log("Error loading image: " + error);
                          });

 

But I can't see the image, I try all, change in the xml the 'src' to 'url' or to 'source' and nothing.

what I did wrong, can anyone help me?

1 Answer, 1 is accepted

Sort by
0
assis
Top achievements
Rank 1
answered on 18 May 2015, 04:16 PM
I see the error, the array was creater before the image was loaded, now is working.
Tags
General Discussions
Asked by
assis
Top achievements
Rank 1
Answers by
assis
Top achievements
Rank 1
Share this question
or