Document Information

Last modified:
2007/05/31 18:18 by thron7

Images in QxListView

How do I get images in a ListView control?

There are some issues getting reliable images in a ListView control in all browsers. There are two possible ways: an iconHtml column or an image column.

In qooxdoo 0.5.1 both possibilities have problems. Code in CVS (and therefore a release later than 0.5.1) has a fix for iconHtml but a little more work is required.

When you use an iconHTML column, explicitly specify iconWidth and iconHeight for images in the column.

For example, this code defines the columns in the ListView:

var lc1 =
{
        pubtime : 
                        { label : "Pub Time", 
                          width : 120, 
                          type : "text", 
                          sortable : true, 
                          sortprop : "text" },
         images : 
                       { label : "Img?", 
                          width : 24, 
                          type : "iconHtml" },
         headline : 
                       { label : "Headline", 
                          width : 240, 
                          type : "text", 
                          sortable : true, 
                          sortprop : "text" }
     }
 
var ld1 = [];
lv1 = new QxListView(ld1, lc1);

This defines the image column to be iconHtml. When loading data into the column, use something like this:

 lv1.getData().removeAll();
lv1.getData().push ({
               pubtime: 
                            { text: "2006-02-26" },
               images:  
                            { icon: "icons/16/thumbnail.png", 
                               iconWidth: 16, 
                               iconHeight:16 },
               headline: 
                            { text: "Headline 1" }
});

Note that iconWidth and iconHeight properties are specified explicitly. If this isn’t done, it will only work in Firefox/Gecko and not in IE.

For the original discussion about this see this mailing list thread.

Information

Last modified:
2007/05/31 18:18 by thron7

Account

Not logged in

 
 

Job Offers

To further improve qooxdoo we are seeking javascript developers. Read more...

Rich Ajax Platform (RAP)

RAP uses qooxdoo, Java and the Eclipse development model to build rich web applications. Read more...

qooxdoo Web Toolkit (QWT)

Similar to GWT this framework allows to create impressive qooxdoo applications just using Java. Read more...

Pustefix

Pustefix is a MVC-based web application framework using Java and XML/XSLT. Read more...

 
SourceForge.net Logo

Bad Behavior has blocked 0 potential spam attempts in the last 7 days.