Hello! Is it possible to edit values in a datatable in JSF? I have this code, which is displaying nicely, but do not store the input in the dataclass! The "kurztext.sprache" is shown correctly and "kurztext.text" also if it has already data. But changes of "kurztest.text" in the GUI are not reflected to the dataclass! Code:

<p:fieldset styleClass="emailSettingFieldset" legend="Materialkurztexte"  style="width: 30%;height:240px; text-align:right;margin-left: 600px; margin-top: -276px">
    <div class="row">
        <div class="col-md-12">
            <p:dataTable id="kurzTexte" var="kurztext"
                value="#{data.materialStammData.materialkurztext}"
                editable="true" style="margin-bottom:0px"
                rowIndexVar="rowIndex" editingRow="true">
                <p:ajax event="rowEdit" />
                <p:ajax event="rowEditCancel" />

                <p:column headerText="Sprache" style="width: 135px">
                    <h:outputText value="#{kurztext.sprache}"
                        style="margin-left: 15px;" />
                </p:column>

                <p:column headerText="Kurztext">
                    <p:cellEditor>
                        <f:facet name="output">
                            <h:outputText value="#{kurztext.text}" />
                        </f:facet>
                        <f:facet name="input">
                            <p:inputText value="#{kurztext.text}" style="width:97%"
                                label="KurztextEingabe" />
                        </f:facet>
                    </p:cellEditor>
                </p:column>

            </p:dataTable>
        </div>
    </div>
</p:fieldset>

Kind regards, Helmut

asked 13.09.2015 at 01:59

Helmut%20Burgemeister's gravatar image

Helmut Burge...
(suspended)
accept rate: 100%

edited 14.09.2015 at 10:33

Reguel%20Wermelinger's gravatar image

Reguel Werme... ♦♦
9.4k31958


There is a sample implementation for an editable table in the 'Html Dialog Demos' project. This project is shipped with the Designer. See /applications/samples/HtmlDialogDemos

In your case the problem could be that you use p:inputText instead of h:inputText. But that's just one difference that popped into my eye when comparing the demo code with your code-snip.

hd demos screenshot

link

answered 14.09.2015 at 10:41

Reguel%20Wermelinger's gravatar image

Reguel Werme... ♦♦
9.4k31958
accept rate: 70%

This was missing: editable="true" editMode="cell" Then the cell could be edited.

(08.10.2015 at 10:57) Helmut Burge... Helmut%20Burgemeister's gravatar image
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×79

Asked: 13.09.2015 at 01:59

Seen: 4,343 times

Last updated: 08.10.2015 at 10:57