p:cellEditor is Outputs Nada

UI Components for JSF
Post Reply
Alan
Posts: 102
Joined: 25 Oct 2010, 04:45

07 Nov 2010, 18:50

I have four columns -- ID (not editable), Description (editable) the p:rowEditor column and a selectionMode="multiple" column.

The description column always shows blank -- as display or in edit-mode. The rowEditListener does get called. I haven't detected any javascript errors but I don't know where to go from here..

Code: Select all

<p:column headerText="Code">
                            <h:outputText value="#{lc.id}" />
                        </p:column>

                        <p:column headerText="Description">
                            <p:cellEditor>
                                <f:facet name="output">
                                    <h:outputText value="#{lc.description}"/>
                                </f:facet>
                                <f:facet name="input">
                                    <h:inputText value="#{lc.description}" size="40"/>
                                </f:facet>
                            </p:cellEditor>
                        </p:column>

                        <p:column headerText="Edit">
                            <p:rowEditor />
                        </p:column>

                        <p:column headerText="Select"
                                  selectionMode="multiple" />
What gets rendered from this is follows. Note that the first <td> element has 302 in it, which is the ID number -- the second <td> element has an empty <span> element in it. This is true even if I remove the EL reference #{lc.description} and replace it with a constant.

Code: Select all

<tr id="lcmForm:lcmTable_row_1" class="ui-widget-content">
                                        <td>
                                            <span>302</span>
                                        </td>
                                        <td class="ui-editable-cell">
                                            <span></span>
                                            <span id="lcmForm:lcmTable:1:j_idt58" class="ui-cell-editor"></span>
                                        </td>
                                        <td>
                                            <span>
                                                <span id="lcmForm:lcmTable:1:j_idt62" class="ui-row-editor">
                                                    <span class="ui-icon ui-icon-pencil"></span>
                                                    <span class="ui-icon ui-icon-check" style="display:none"></span>
                                                    <span class="ui-icon ui-icon-close" style="display:none"></span>
                                                </span>
                                            </span>
                                        </td>
                                        <td class="ui-selection-column">
                                            <input type="checkbox" name="lcmForm:lcmTable_selection_checkbox" />
                                        </td>
                                    </tr>
Very much confused here.
Netbeans 7.1, GlassFish 3.1.1, MacOS X 10.6.8, Safari, Firefox

Alan
Posts: 102
Joined: 25 Oct 2010, 04:45

08 Nov 2010, 00:25

OK, hold the phone. I was looking at the source to try to figure out this problem and discovered that in the subversion repository the current implementation of CellEditorRenderer looks like this:

Code: Select all

    public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
        ResponseWriter writer = context.getResponseWriter();
        CellEditor editor = (CellEditor) component;
        
        writer.startElement("span", null);
        writer.writeAttribute("id", component.getClientId(context), null);
        writer.writeAttribute("class", DataTable.CELL_EDITOR_CLASS, null);

        writer.startElement("span", null);
        writer.writeAttribute("class", DataTable.CELL_EDITOR_OUTPUT_CLASS, null);
        editor.getFacet("output").encodeAll(context);
        writer.endElement("span");

        writer.startElement("span", null);
        writer.writeAttribute("class", DataTable.CELL_EDITOR_INPUT_CLASS, null);
        editor.getFacet("input").encodeAll(context);
        writer.endElement("span");

        writer.endElement("span");
    }
and when I set a breakpoint I found out that the source code in the JAR file from the local maven repository (i.e the one I am running) looks like this:

Code: Select all

   public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
        ResponseWriter writer = context.getResponseWriter();
        
        writer.startElement("span", null);
        writer.writeAttribute("id", component.getClientId(context), null);
        writer.writeAttribute("class", DataTable.CELL_EDITOR_CLASS, null);
    }

    @Override
    public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
        ResponseWriter writer = context.getResponseWriter();
        
        writer.endElement("span");
    }
So the question becomes is the maven repository copy a bad one? And if so how do I get it right? My dependency looks like this:

Code: Select all

 <dependency>
            <groupId>org.primefaces</groupId>
            <artifactId>primefaces</artifactId>
            <version>2.2.RC1-SNAPSHOT</version>
        </dependency>
I am pretty new to using maven, is there something to do to get the right copy I am not doing?
Netbeans 7.1, GlassFish 3.1.1, MacOS X 10.6.8, Safari, Firefox

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 51 guests