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
233
Web Grid Smart Refresh Problem
posted

I want to use Smart Refresh on a WebGrid component by clicking a h:commandButton component, but I found that the whole page refreshes instead of just the grid data. My code is as follows:

JSP:

<h:form id="myTradingPlatform">
     <h:panelGroup styleClass="section">
      <ig:tabView id="myAcctInfoTab">
       <ig:tabItem value="Order Book">
         <ig:link id="refreshLink" actionListener="#{orderBook.onRefreshButtonClick}" smartRefreshIds="orderBookGridView" value="refresh" />
         <h:commandButton value="Refresh" id="refreshButton" onclick="BLOCKED SCRIPTig.smartSubmit('myTradingPlatform:myAcctInfoTab:refreshLink', null, null, 'myTradingPlatform:myAcctInfoTab:orderBookGridView', null);" />

.....

(since the ig:smartSubmit needs to use NetAdvantage component in the first parameter, so i created a dummy refresh link as above for this purpose. Would you please also advise if there is another better approach?)

Backing Bean:

    public void onRefreshButtonClick(ActionEvent e){
        enquireOrderStatus();
    }
   
    public OrderStatusBean getOrderStatus(){
        if (orderStatus == null){
            orderStatus = new OrderStatusBean();
            orderStatus.enquireOrderStatus();
        }
        return orderStatus;
    }
   
    public void enquireOrderStatus(){
        getOrderStatus().enquireOrderStatus();
        orderBookGridView.dataBind();
    }

 Have I made something wrong such that the smart refresh does not work ?

Parents
  • 1324
    posted

    Hello,

    Whay you are using commandButton if you want to make a smartRefresh. You should use the html button to call smartSubmit() by using its onClick attribute.

    Note that commandButton will cause a full post back by its design, if you are not canceling / blocking its submit manually. And if you cancel / block its submit behavior, you will not be able to use its action or actionListener to work.

    So better option is to use html button instead of commandButton. Or if you can go throgh the hyperlink, it is best to use the ig:link.

    With ig:link, you will be able to make smartRefresh with invoking the actionListener without a full form submit.

     

    Thank you

    Roshan

Reply Children