-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi everybody, I want to develop an application that uses a grid for displaying a specific set of data. I want to provide a bulk close functionality where users can select all the items in the present page (not all the pages) and then perform a closure operation for all of these items. This approach is very similar to the one offered in Google mail. The grid is displayed below:
<button label="Close" id="bulkclose" sclass="button"/>
<grid id="grid" sclass="grid"
height="100%"
width="100%"
emptyMessage="Nothing in Data List."
mold="paging"
pagingPosition="bottom"
autopaging="true">
<columns width="5%">
<column width="3%" label="" valign="center" align="center"><checkbox id="selectAll"/></column>
<column width="3%" label=""/>
<column width="6%" label="ID" align="left"/>
<column width="11%" label="CREATED DATE" align="left"/>
<column width="5%" label="CATEGORY" align="left"/>
<column width="8%" label="CLOSED DATE" align="left"/>
<column width="10%" label="USER" align="left"/>
<column width="8%" align="center" label=""/>
</columns>
</grid>
In the controller class I have implemented the following method for the selectAll checkmark.
public void onCheck$selectAll(Event evt) {
if (isSelectedAll == false) {
if (alerts != null && alerts.size() > 0) {
for (Alert alert : alerts) {
alert.setChecked(true);
}
bulkclose.setVisible(true);
grid.setModel(alerts);
}
isSelectedAll = true;
} else {
if (alerts != null && alerts.size() > 0) {
for (alert alert : alerts) {
alert.setChecked(false);
}
bulkclose.setVisible(false);
grid.setModel(alerts);
}
isSelectedAll = false;
}
}
With this code I am able to perform a bulk selection for ALL the items in the grid (in all the pages) but I can't find a way to do so for the current page only. I need to use a grid, the listbox cannot be used. Any thought?
Hello Antoc,
Since you want only the selected items for the current page you could use a paging component where on each onPage change event you could reset the selected items to unselected.
Best Regards,
Darksu
Asked: 2015-01-13 17:02:56 +0800
Seen: 19 times
Last updated: Jan 18 '15
grid.getPaginal? You could have the current page and pagesize from that. Count it out untill you have first and last index of you model.
chillworld ( 2015-01-15 23:19:52 +0800 )edit