0

I have a datatable with a column button that fires a dialog modal and a .properties file with the various id's of the application pages.

Column example:

<p:column style="width:32px;text-align: center">
         <p:commandButton icon="ui-icon-search" headerText="Detail" update=":form_datatable:dialog_datatable" oncomplete="PF('dialog_datatable').show()">
            <f:setPropertyActionListener value="#{row}" target="#{testBean.selectedRow}" />
         </p:commandButton>
</p:column>

Propierties:

application.table.dialog=dialog_datatable

I just want to avoid hardcoding the oncomplete="PF('dialog_datatable').show()" and use .propierties inside of the EL expresion. There is any posible way?

Like: oncomplete="PF(#{app.['application.table.detail']}).show()"

EDIT: @BalusC Isn't the same type of question, the other one is using a var="" inside the same xhtml datatable, im trying to use a .propierties file to don't hardcode id/widgetVar.

EDIT2: After some research in my free time i finally found a way to do it, is better than hardcode it. (i don't know how i can answer my own question...)

    <ui:param name="var_dialog" value="#{app['application.table.dialog']}" />
    <p:commandButton icon="ui-icon-search" update=":form_city:dialog_city" oncomplete="PF('#{var_dialog}').show()">
Cœur
  • 37,241
  • 25
  • 195
  • 267
GBS
  • 124
  • 1
  • 3
  • 16
  • Two things wrong here... the . after app should not be there and the whole 'EL' part should be in single quotes (it should result in PF('id') and now it is PF(id). You need to escape the single quotes in the [ ]. And just try and see what errors you get. – Kukeltje Sep 29 '16 at 08:36
  • First of all thanks for your answer, i tried to remove the quotes inside the [ ] resulting on this: oncomplete="PF(#{app.[application.table.detail]}).show()". The errors are: eclipse EL syntax error: Expecting Java method or property name. And browser: oncomplete="PF(#{app.[application.table.detail]}).show()" Failed to parse the expression [PF(#{app.[application.table.detail]}).show()] – GBS Sep 29 '16 at 09:09
  • 1
    No, I did not say remove the quotes in the [ ], I said **escape** (but this might not be needed after all) And you **did not** remove the . after app. And you **did not** put single quotes in side the ().... PLEASE read what I state. It should be `PF('#{app['application.table.detail']}')` or `PF('#{app[\'application.table.detail\']}')` but I think the former might already do the trick – Kukeltje Sep 29 '16 at 09:12
  • What are you tring to say with escape is: ' ? it results on this: oncomplete="PF('#{app[''application.table.detail']}').show()". The page load correctly but when i click the button browser fires the error: Uncaught TypeError: Cannot read property 'show' of undefined – GBS Sep 29 '16 at 09:26
  • Failed to parse the expression [PF('#{app[\'application.table.detail\']}').show()] it failed again... In eclipse the error is: Multiple annotations found at this line: - Syntax error in EL - EL syntax error: Expecting expression. – GBS Sep 29 '16 at 09:28
  • @BalusC: The escaping of the 'key' with dots (.) in them is the related issue here... I cannot seem to find an explicit duplicate of that – Kukeltje Sep 29 '16 at 09:47
  • tried `PF('#{app['application.table.detail']}')` to? – Kukeltje Sep 29 '16 at 09:47
  • @Kukeltje: yes, i tried it, and nothing... – GBS Sep 29 '16 at 10:05
  • nothing what? Error? WW3? – Kukeltje Sep 29 '16 at 11:08
  • @Kukeltje: This? http://stackoverflow.com/q/33019729 – BalusC Sep 29 '16 at 11:13
  • @BalusC: yes, thanks – Kukeltje Sep 29 '16 at 17:00

0 Answers0