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
85
WebGrid data refresh problem
posted

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;
    }
    
   }

Parents
  • 12025
    posted

    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.

Reply Children