I need to disable row Editor in some rows(because of their specific data) I search too much but I can't find a way to do that.
I have two type of rows,rows with status A and rows with status B.
I want to enable pencil for rows A and disable for rows B
Disable pencil of RowEditor
- andyba
- Expert Member
- Posts: 2473
- Joined: 31 Mar 2011, 16:27
- Location: Steinfeld, near Bremen/Osnabrück, DE
- Contact:
I don't think you can easily disable it but the rowEditor component does have the rendered attribute, try using that. If it causing a row based rendering according to a row based criteria then you will have pencils only in those rows which can be edited which pretty much follows common practice of only exposing controls when they can be used.
PF 4.x (Elite versions), PF 5, Pf 5.1, PF 6.0
Glassfish 4.1, Mojarra 2.x, Java 8, Payara 4.1.1.
If you haven't read the forum rules read them now
Glassfish 4.1, Mojarra 2.x, Java 8, Payara 4.1.1.
If you haven't read the forum rules read them now
i tried this code but it didn't work:
<p:column rendered="#{contract.status != "done"}">
<p:rowEditor />
</p:column>
(actualy 'B',is "Done")
Error is this:
javax.servlet.ServletException: Error Parsing /contract/index.xhtml: Error Traced[line: 250] Element type "p:column" must be followed by either attribute specifications, ">" or "/>".
<p:column rendered="#{contract.status != "done"}">
<p:rowEditor />
</p:column>
(actualy 'B',is "Done")
Error is this:
javax.servlet.ServletException: Error Parsing /contract/index.xhtml: Error Traced[line: 250] Element type "p:column" must be followed by either attribute specifications, ">" or "/>".
Last edited by farshi114 on 11 Apr 2013, 17:29, edited 2 times in total.
primFaces 3.5+jsf 2+GlassFish 3.1.2
- andyba
- Expert Member
- Posts: 2473
- Joined: 31 Mar 2011, 16:27
- Location: Steinfeld, near Bremen/Osnabrück, DE
- Contact:
Well your EL is wrong, use (note the use of code tags here)farshi114 wrote:i tried this code but it didn't work:
<p:column rendered="#{contract.status != "done"}">
<p:rowEditor />
</p:column>
(actualy 'B',is "Done")
Error is this:
javax.servlet.ServletException: Error Parsing /contract/index.xhtml: Error Traced[line: 250] Element type "p:column" must be followed by either attribute specifications, ">" or "/>".
Code: Select all
rendered="#{'done' ne contract.status}"
Secondly you do not want to provisionally render the column because you can't.
You do this with the rowEditor component, like this
Code: Select all
<p:rowEditor rendered="#{'done' ne contract.status}"/>
Code: Select all
public boolean getRenderContractEditor(Contract contract) {
return !"done'.equals(contract.getStatus());
}
Code: Select all
<p:rowEditor rendered="#{contractController.renderContractEditor(contract)}"/>
- You only need to implement this logic in one place but use the result of the method call in many places (satisfies the DRY principle)
- Places the responsibility for this with the contract controller where it belongs (Satisfies the S in SOLID)
There are others as well.
PF 4.x (Elite versions), PF 5, Pf 5.1, PF 6.0
Glassfish 4.1, Mojarra 2.x, Java 8, Payara 4.1.1.
If you haven't read the forum rules read them now
Glassfish 4.1, Mojarra 2.x, Java 8, Payara 4.1.1.
If you haven't read the forum rules read them now
-
- Information
-
Who is online
Users browsing this forum: No registered users and 27 guests