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
250
Grid refresh using server polling
posted

Hi,

 I m trying to refresh the contents of the grid by using the server polling mechanism.
 
I can call the server side getter for the list to be populated after the time interval.
The problem is with rendering the data on the web page.

Do i need to use grid.dataBind()? if yes, where?

Is there something i m missing? or is it that this feature is not supported yet.

Code is given below:

JSP:

<f:view>
 <html>
 <head>
 <script type="text/javascript">
 var t;
 function walker()
 {
  ig.smartSubmit('eventform:events',null,null, 'eventform:events', null);
  t=setTimeout("walker()", 10000);
 }
 </script>
 </head>
 <body onload="walker();">

 <h:form id="eventform">
  <ig:gridView dataSource="#{notification.eventlist}" id="events" binding="#{notification.grid}">
   <ig:column>
    <f:facet name="header">
     <h:outputLabel id="listheader" value="Event ID" />
    </f:facet>
    <h:outputText id="eventid" value="#{DATA_ROW.eventid}" />
   </ig:column>
   <ig:column>
    <f:facet name="header">
     <h:outputLabel id="listheader" value="Event Description" />
    </f:facet>
    <h:outputText id="eventdesc" value="#{DATA_ROW.eventDesc}" />
   </ig:column>
  </ig:gridView>
 </h:form>
 </body>
 </html>
</f:view>

BEAN:

public class NotificationBean implements Serializable {
 
 NotificationService notificationService = new NotificationService();

 private List eventlist;
 
 private GridView grid;

 public List getEventlist() {
  eventlist = notificationService.getAllEventsAsList();
  return eventlist;
 }

 public void setEventlist(List eventlist) {
  this.eventlist = eventlist;
 }
 
 public GridView getGrid() {
  return grid;
 }

 public void setGrid(GridView grid) {
  this.grid = grid;
 }
}

Thanks,
Sachin.