java - h:commandButton not invoked when nested into own component extending UIData -


i have seen answer balusc , solution changing scope, tried , think there yet problem seems not solvable using jsf2.

i have created custom component extends uidata. custom component displays table rows of data, called pagingdatatable. cotains pagingdatacolumns can clicked , sort ordering changed etc...

this works fine, add h:commandbutton inside pagingdatacolum, action of button not invoked. let me explain this:

  • it works when using nested f:ajax element
  • but not work when defining action in h:commandbutton without nesting

in special case don't want use ajax it. debugged , found out mismatch in mojarra implementation of buttonrenderer class (method wasclicked). inside method, checked whether button clicked, , check done according id (actually name, id). uidata components have 2 different ids:

  • id rowindex when rowindex exists, e.g. while rendering
  • id without rowindex when rowindex not exist, e.g. when user clicks button

so wasclicked() tries find id without rowindex in parameter map, no avail, , because of this, action method not invoked.

imho bug in buttonrenderer.wasclicked() method, need have additional logic able understand id without rowid not exact match in parameter map id rowid.

did miss here? imho has nothing scope of underlying data, because rowid not there in case, independent of scope. tried sessionscoped, , same thing happening.

i download version 2.1.28 of mojarra: same thing happening. mojarra 2.2.x seems not work glasssfish server version, not try newest version. kind of stuck here, , use case quite simple: add button column of pagingdatatable , let invoke action.

it possible make workaround this, either using ajax or doing js coding myself... should not necessary in jsf2? appreciated.

ok, sorry asking question. seems when adding

<f:param name="cid" value="#{javax.enterprise.context.conversation.id}" />  

nested in h:commandbutton, (magically) set rowindex of row clicked, , logic in buttonrenderer working again. runs smoothly then.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -