I have a GridView inside a panel that is set to be initially rendered as false, in the backing bean after getting the data and binding it to the grid I'm setting the panel's rendered attribute to be true. This works fine, the grid appears with the data in it, however the column that I set up ( and need ) in the grid is no longer editable. If the panel's rendered attribute to initialy be true everything is fine. I'm creating most of the GridView in the backing bean. The happens in both the ie and firefox browsers.
Thanks much,
Eric Bieche
JSF Code snippet :
<h:panelGroup style="width: 100%;" > <h:panelGrid columns="1" rendered="#{page.showGrids}" >
<h:panelGroup > <h:panelGrid columns="1" >
... other stuff ....
<h:panelGroup style="width: 20%;" > <ig:gridView id="totalGrid" allowFixedColumns="true" rowFetchSize="300" loadOnDemand="default" columnStyleClass="font-style: normal; font-family: Arial, Verdana, Sans-Serif;" style="height: 200px; font-style: normal; font-family: Arial, Verdana, Sans-Serif; font-weight: bold;" binding="#{page.totalGrid}" dataSource="#{page.totalDmaData}" > <ig:gridEditing id="totalGridEdit" enableOnMouseClick="single" cellValueChangeListener="#{page.cellValueChangeListener}" /> <ig:gridActivation id="totalGridActivation" /> </ig:gridView> </h:panelGroup> </h:panelGrid> </h:panelGroup>
</h:panelGrid> </h:panelGroup>
The backing bean code to init the grid and create the columns looks like
private void initGrid(GridView grid, ColumnMetaData [ columns) throws Exception { FacesContext context = FacesContext.getCurrentInstance(); if(grid != null) clearGrid(grid); // These are the columns of the grid // loop through the meta-data defining the columns in the dataModel // and create a column in the grid for basic data type for (int index = 0; index < columns.length; index++) { ColumnMetaData columnMetaData = columns[index]; if (columnMetaData != null && columnMetaData.getDatatype() != List.class) { Column column = null; boolean readOnly = true; // Currently there are two columns that can be edited by the user if( "factor".equals(columnMetaData.getName()) || "finalPen".equals(columnMetaData.getName()) ) { readOnly = false; } column = createColumn( context, columnMetaData.getDisplayName(), "#{DATA_ROW." + columnMetaData.getName() + "}", columnMetaData.getName(), readOnly); grid.getTemplateItems().add(column); } } grid.dataBind(); }//End of initGrid /** * * @param context * @param header * @param binding * @param sortByCriteria * @param readOnly * @return */ private Column createColumn(FacesContext context, String header, String binding, String sortByCriteria, boolean readOnly) { Application application = context.getApplication(); UIViewRoot viewRoot = context.getViewRoot(); Column column = (Column) application.createComponent(Column.COMPONENT_TYPE); column.setId(viewRoot.createUniqueId()); if (header != null) { UIOutput columnHeader = (UIOutput) application.createComponent(UIOutput.COMPONENT_TYPE); columnHeader.setValue(header); columnHeader.setId(viewRoot.createUniqueId()); column.setHeader(columnHeader); } UIOutput columnContent = new UIOutput(); columnContent.setId(viewRoot.createUniqueId()); // define the value binding columnContent.setValueBinding( "value", context.getApplication().createValueBinding(binding)); column.getChildren().add(columnContent); // if there a sortBy criteria if (sortByCriteria != null) { column.setSortBy(sortByCriteria); } column.setReadOnly(readOnly); return column; }//End of createColumn