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; } }
Hello,
You need to set the fully qualified client id of the grid in the smartRefreshIds attribute. Since, you have a form id set, on the client the grid id becomes "formMonitCajon:tabla" , so set the smartRefreshIds attribute as:
smartRefreshIds="formMonitCajon:tabla"
Taz.
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
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