Hi,
I have the following facelets:
<ui:define name="body"> <h:form id="assetForm"> <h:panelGrid columns="2"> <h:outputText value="#{gui['assetGroup.id']}:"/> <h:inputText id="ag_publicId" size="15" value="#{assetController.assetGroupExample.publicId}"/> <f:facet name="footer"> <h:panelGroup> <ig:link id="ag_search" value="#{gui['search']}" smartRefreshIds="agListTable" actionListener="#{assetController.findAssetGroupListener}" /> <h:commandButton id="ag_reset" type="reset" value="#{gui['reset']}" /> </h:panelGroup> </f:facet> </h:panelGrid> <ig:gridView id="agListTable" dataKeyName="id" binding="#{assetController.agGridUI}" dataSource="#{assetController.assetGroups}" pageChangeListener="#{assetController.assetGroupsOnPageChangeListener}" pageSize="15"> <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:gridView> <ig:link id="addBtn" iconUrl="/images/icon_add_binding.gif" immediate="true" smartRefreshIds="agListTable" actionListener="#{assetController.chooseAssetGroupsListener}" /> </h:form> </ui:define>
.. and methods from controller:
private AssetGroup assetGroupExample = new AssetGroup();
private List<AssetGroup> assetGroups = new ArrayList<AssetGroup>();
public void findAssetGroupListener(ActionEvent event) { this.assetGroups = null; this.agGridUI.dataBind(); }
public DataModel getAssetGroups() { if (assetGroups == null) { this.assetGroups = assetGroupService.findAssetGroups(getActiveIteration(), assetGroupExample); } return new ListDataModel(assetGroups); }
public void chooseAssetGroupsListener(ActionEvent event) { RowItem rowItem; Iterator selectedRows = agGridUI.getSelectedRows().iterator(); boolean isChange = false; while (selectedRows.hasNext()) { ----------------------------->>> PROBLEM rowItem = (RowItem) selectedRows.next(); //get asset group id Long agId = (Long)GridView.getDataKeyValue(rowItem); //add asset into selected asset group assetService.addAssetIntoGroup(asset, agId); //deselect item rowItem.setSelected(false); isChange = true; } //end-while }
And description of steps:
1. form is shown with empty web grid (assetGroups = null;)
2. then user can click on search button (id="ag_search") to find items
3. new items are loaded (findAssetGroupListener() nulls data and ask for grid data reload)
4. user selects one item and clicks to add button (id="addBtn")
5. listener chooseAssetGroupsListener() is called but there is no selected items.Or it's not exception when something is selected but with wrong id.
I'm not sure but this works in "normal" JSF but there is now problem after moving to facelets. We use 8.2.20082.1003 version. Doesn't it anything in common with DataModel problem (http://forums.infragistics.com/forums/p/3607/20385.aspx)?
ANECT
Normal 0 21 false false false CS X-NONE X-NONE MicrosoftInternetExplorer4 /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;}
Hello,
I found out that problem is propably in AJAX communication. When I remove smartRefreshIds="agListTable" from first or second or both ig:links then it works fine. It means without AJAX communication.
Please, what's wrong?
Thank you,
I'm sorry for mistake in my previous reply - problem is when grid view is rendered by AJAX. That is when user fills form data and wants to rebind grid's data by AJAX call. When this is without AJAX (ig:link doesn't have smartRefreshIds) then it works fine -> selected row (item) is correctly processed.
I also add information that we use JSF 1.2.