Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
755
AJAX using on the server side
posted

Hello,

I have been inspired by example "Using the SmartRefresh Manager." (http://www.componentsforjsf.com/WebAJAXExamples/faces/examplePages/ajaxWithSRM.jsp) but without success result.

I have ig:gridview with the following command link in each row:

              <h:commandLink title="#{gui['_global.delete.alt']}" styleClass="actionPadded"
                  immediate="true"                  
                  actionListener="#{assetGroupController.removeAssetListener}"
                  onclick="if (!confirm('#{gui['_global.confirmDeletion']}')) return false;">
                <h:graphicImage url="/images/icon_remove.png"/>
              </h:commandLink>             

And here is action listener:

  public void removeAssetListener(ActionEvent event) {
    //get reference to grid's row item
    RowItem rowItem = (RowItem) event.getComponent().getParent().getParent();

    //remove asset from selected group
    Long assetId = (Long)GridView.getDataKeyValue(rowItem);
    if (assetId != null) {
      assetGroupService.deleteAssetFromGroup(assetId, assetGroup.getId());
         
      this.assetGroupMembers = null;
      this.agAssetsGridUI.setPageIndex(0);
      this.agAssetsGridUI.dataBind();     
    }   
   
    SmartRefreshManager srm = SmartRefreshManager.getCurrentInstance();
    srm.addSmartRefreshId(agAssetsGridUI.getClientId(getContext()));
    System.out.println(srm.isSmartRefresh(getContext()));
  }

Result is that Javascript fragment from server is displayed instead of processing by some component. Maybe reason is that srm.isSmartRefresh(context) function returns false in the listener - but how can I enable smart refresh? Isn't it possible in your listeners only?

Thank you,

ANECT