PDA

View Full Version : GXT 3.0 ListView - Icon + String



mahanagarjuna
18 Apr 2012, 4:17 AM
Hi,

I am new to GWT/GXT and I need to create a ListView which shows list of Strings with Icons to the Left.

Using templates it seems do able, but not sure how. Need help.

Thanks in advance!

sven
18 Apr 2012, 4:31 AM
I would use a CompositeCell that containts the ImageResourceCell and a SafeHtmlCell. All comming from GWT.

jdkida
8 Jun 2013, 10:31 AM
Hi Sven,

I am trying to do the same thing. I got it working with a static icon, but what if I want to use the icon from the model? i.e I have a model that provides an ImageResource, how can I show the image next to the the model string.. Here is what I have so far.. but like i said this will only show a single image, how can I pull the image from the model.



resources = GWT.create(AppResources.class);

navStore = new ListStore<NavigationPaneSectionModel>(props.key());
navStore.add(new NavigationPaneSectionModel("accounts", resources.note(), "Accounts"));
navStore.add(new NavigationPaneSectionModel("tickets", resources.bino_search(), "Tickets"));
navStore.add(new NavigationPaneSectionModel("leads", resources.email_add(), "Leads"));

IconCellDecorator<String> iconCell = new IconCellDecorator<String>(resources.note(), new TextCell());

navList = new ListView<NavigationPaneSectionModel, String>(navStore, props.displayLabel());
navList.setCell(iconCell);
this.setWidget(navList);