Hi, i got a WebGrid which i pupulate with initialized data, so on a checkbox click i change data, the problem is that WebGrid is not
refreshed until i key F5 on my keyboard, my bean is session scope, the code i got is:
<h:form id="formMonitCajon"> <ig:checkBox binding="#{MonitCajonBean.chkSoloCajeros}" label="Activar solo cajero" smartRefreshIds="tabla" valueChangeListener="#{MonitCajonBean.onCheckSoloCajeros}"/> <br> <ig:gridView binding="#{MonitCajonBean.tablaMonitCajon}" id="tabla"> </ig:gridView> </h:form>
public class MonitCajonBean { public MonitCajonBean() { try { initTabla("Tabla inicial"); // SETTING TITLE FOR EXAMPLE
}catch(Exception e) { //Logs.backend.error(e.toString()); // REDIRECCIONAR A UNA PAGINA DE FALLA } } private void initTabla(String titulo){ tablaMonitCajon=new HtmlGridView(); HtmlOutputText tit=new HtmlOutputText(); tit.setValue("Monitoreo a Caja "+ titulo); // SETTING TITLE FOR EXAMPLE tablaMonitCajon.setHeader(tit); com.infragistics.faces.grid.component.Column col1=new com.infragistics.faces.grid.component.Column(); HtmlOutputText enc1=new HtmlOutputText(); enc1.setValue("Header 1"); col1.setHeader(enc1); tablaMonitCajon.getColumns().add(col1); com.infragistics.faces.grid.component.Column col2=new com.infragistics.faces.grid.component.Column(); HtmlOutputText enc2=new HtmlOutputText(); enc2.setValue("Header2"); col2.setHeader(enc2); tablaMonitCajon.getColumns().add(col2);
HtmlOutputText valor1=new HtmlOutputText(); valor1.setValue("valor1"); valor1.setStyleClass("Titulos"); HtmlOutputText valor2=new HtmlOutputText(); valor2.setValue("valor2"); com.infragistics.faces.grid.component.RowItem ren1=new com.infragistics.faces.grid.component.RowItem(); com.infragistics.faces.grid.component.Cell cel1=new com.infragistics.faces.grid.component.Cell(); com.infragistics.faces.grid.component.Cell cel2=new com.infragistics.faces.grid.component.Cell(); cel1.getChildren().add(valor1); cel2.getChildren().add(valor2); ren1.getCells().add(cel1); ren1.getCells().add(cel2); tablaMonitCajon.getRows().add(ren1); tablaMonitCajon.dataBind(); } private HtmlGridView tablaMonitCajon = null; public HtmlGridView getTablaMonitCajon() { return tablaMonitCajon; }
public void setTablaMonitCajon(HtmlGridView tablaMonitCajon) { this.tablaMonitCajon = tablaMonitCajon; } public void onCheckSoloCajeros(ValueChangeEvent event) { try { if(chkSoloCajeros.isChecked()) { initTabla("true"); // CHANGING TITLE FOR EXAMPLE }else { initTabla("false"); // CHANGING TITLE FOR EXAMPLE } }catch(Exception e) { //Logs.backend.error(e.toString()); // REDIRECCIONAR A UNA PAGINA DE FALLA } } private CheckBox chkSoloCajeros = null;
public CheckBox getChkSoloCajeros() { return chkSoloCajeros; }
public void setChkSoloCajeros(CheckBox chkSoloCajeros) { this.chkSoloCajeros = chkSoloCajeros; } }
Hi,
There is no igf_effect.js in 2007.2 or 2008.1. It is a mistake in the documentation, which will be fixed. Thanks very much for that feedback.
As for the dynamic grid, you could try only setting the data in the change listener, and not creating the whole grid from scratch every time.
Regarding smart refresh not working, could you post any server logs or error messages from the browser? Thanks very much in advance.
--Angel
Hi Taz,
One does not need to set the fully qualified client id. It is formed automatically. The smart refresh id should be the logical Id that is set in the JSP.
Hi Murtaza.. help me..
I think the problem of smart refresh is not on the code or tag part. I try to run the demo and the smartgrid does not work also. For example, I open page listing hierarchical grid. When I try to expand the the row, It did not shows the nested table.
I think there might be something wrong in application server or missing dependencies. I use Sun Java Application server 9. Basically I just unpack the C:\Program Files\NetAdvantage for JSF\demos\war\j2ee.1.4\infragistics-netadvantage.war, put license under WEB-INF, repack it again. Then deploy it on server.
Btw, In documentation ( Getting Started->Deploying your application->deploying your application) it mention igf_effect.js. But in the package, demo and inffragistics lib, there is no such script file. What is this script for? Could that be possible that smartRefresh does not work because we do not have this file on the dependency list?
Thanks,
hida
i've tried your suggested changes and still not working, in fact the problems is with WebGrid only, because in the same form i put an outputText which value is also updated when user makes click on the checbox, and it is updated sucessfully, but WebGrid isn't, what could be happening?smartrefresh is not working like expected in some components.
Regards!
Hi..
I try to follow yours,, but failed.
I am using netbeans 6. I want the page to update output text whenever the checkbox list is selected. What name should I put on smartRefreshIds?
should I make it smartRefreshIds="pageDef:htmlDef:head1:link1:body1:form1:Configurator:displaySelectedItem" ?
Here is my code..
defaulPage.jsp
<jsp:root version="2.1" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:webuijsf="http://www.sun.com/webui/webuijsf"> <jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/> <f:view> <webuijsf:page binding="#{DefaultPage.pageDef}" id="pageDef"> <webuijsf:html binding="#{DefaultPage.htmlDef}" id="htmlDef"> <webuijsf:head binding="#{DefaultPage.head1}" id="head1"> <webuijsf:link binding="#{DefaultPage.link1}" id="link1" url="/resources/stylesheet.css"/> </webuijsf:head> <webuijsf:body binding="#{DefaultPage.body1}" id="body1" style="-rave-layout: grid"> <webuijsf:form binding="#{DefaultPage.form1}" id="form1"> <div style="left: 0px; top: 0px; height: 100px; width: 1000px; position: absolute"> <jsp:directive.include file="Header.jspf"/> </div> <div style="height: 250px; left: 0px; top: 110px; position: absolute; width: 220px"> <jsp:directive.include file="Menu.jspf"/> </div> <div style="height: 690px; left: 230px; top: 110px; position: absolute; width: 770px"> <jsp:directive.include file="DefaultContent.jspf"/> </div> <div style="height: 430px; left: 0px; top: 370px; position: absolute; width: 220px"> <jsp:directive.include file="Configurator.jspf"/> </div> </webuijsf:form> </webuijsf:body> </webuijsf:html> </webuijsf:page> </f:view></jsp:root>
Configurator.jspf (fragment)
<div style="height: 430px; width: 220px; -rave-layout: grid" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ig="http://ko.infragistics.com/faces/netadvantage" xmlns:webuijsf="http://www.sun.com/webui/webuijsf"> <f:subview id="Configurator"> <webuijsf:panelGroup styleClass="main"> <webuijsf:staticText binding="#{Configurator.confTitle}" escape="false" id="confTitle" style="color: navy; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 12px; font-style: normal; font-weight: normal; left: 2px; top: 2px; position: absolute; width: 94px" text="Configuration"/> <ig:checkBoxList binding="#{Configurator.selectedCheckBoxItems}" immediate="true" dataSource="#{Configurator.checkBoxItem}" id="checkBoxList" smartRefreshIds="Configurator:displaySelectedItem" style="left: 2px; top: 30px; position: absolute" valueChangeListener="#{Configurator.onCheckedItem}"/> <h:outputText id="displaySelectedItem" rendered="true" style="position: absolute; left: 0px; top: 100px" value="#{Configurator.displayText}"/> </webuijsf:panelGroup> </f:subview></div>