Hello,
I found the following possible bug. I have table with 2 pages, one item is on each page.
When I remove dynamically (via listener) item on the second page then empty table is displaied.
I also attach some code snippets:
<ig:gridView id="agListTable2" dataKeyName="id" binding="#{assetTestController.agGridUI2}" dataSource="#{assetTestController.assetGroups2}" selectedRowsChangeListener="#{assetTestController.onSelectedRowsChange2}" pageSize="1"> <ig:columnSelectRow showSelectAll="true" /> <ig:column sortBy="publicId"> <f:facet name="header"> <h:outputText value="#{gui['assetGroup.id']}" /> </f:facet> <h:outputText value="#{DATA_ROW.publicId}" /> </ig:column> <ig:column sortBy="name"> <f:facet name="header"> <h:outputText value="#{gui['asset.groupName']}" /> </f:facet> <h:outputText value="#{DATA_ROW.name}" /> </ig:column> <ig:column> <ig:link iconUrl="images/icon_remove.gif" smartRefreshIds="agListTable2" actionListener="#{assetTestController.removeAssetGroupListener}" /> </ig:column> </ig:gridView>
public void removeAssetGroupListener(ActionEvent event) { //get reference to grid's row item RowItem rowItem = (RowItem) event.getComponent().getParent().getParent(); //remove asset from selected group Long agId = (Long)GridView.getDataKeyValue(rowItem); assetGroups2.remove(agId.intValue()-1); agGridUI2.dataBind(); }
I use latest hotfix 2014.
Best regards,
ANECT
Hi,
This problem occurs when you delete the record on the second page in the grid with two pages and one record on each page. It is not a bug but the by design behaviour of the grid - when you delete the second of two records the grid after rebinding the grid will still display the second page (there are no records now) and the pager will not display (because it is calculated that we have only one page now). So we still have the data but we are on the wrong page and cannot go to the previous. But you can easily put the things right by adding some code in the backing bean before we rebind the grid.
In Java:
if (index != 0) {
}
grid.dataBind();
Regards!