Reputation: 25
I have create my image list page like this, using the listView to display the images:
image1 image2
image3 image4
image5
And now there is a requirement that I need to select the images to delete. Can I make the listItem selected? How to do that?
Thanks!
Upvotes: 0
Views: 178
Reputation: 25
I did as below:
In the amx file, add an component into the :
<amx:selectBooleanCheckbox id="sbc1" inlineStyle="width:#{(deviceScope.hardware.screen.availableWidth/2)-10}px;"
value="#{row.deleted}"/>
Here the value of row.deleted will be set to true, when the user click the selectBooleanCheckbox.
Then in the related ManagedBeans class, we can check if the value of row.deleted is true or not.
Iterate the imageList, If the value of deleted is true, then we remove the related image from the image List. For example:
Iterator itr = imageList.iterator();
while(itr.hasNext()) {
ImageFile imageItem = (ImageFile) itr.next();
if (imageItem.isDeleted()) {
itr.remove();
}
}
Here the ImageFile is a class to store the image. It contains:
private String imageFile;
private Integer imageFileId;
private boolean deleted;
and the getter and setter.
Upvotes: 1