question: how may update several single rows of p:panelgrid
?
i creating complex table p:panelgrid
, custom facelet tags templating. events triggered in several cells requires update of other parts of table. handy able update complete row @ once. far able update content inside single cells.
my custom tag:
<p:row id=#{rowid}> <p:column> <some:inputcomponent> <p:ajax update=#{toupdate} /> </some:inputcomponent> </p:column> </p:row>
usage in panelgrid:
<p:panelgrid> <my:row value=#{foo} rowid="one" /> <my:row value=#{bar} rowid="two" toupdate="one"/> </p:panelgrid>
on change of component (like p:spinner
in case) in second row , after executation of action listener, want update complete first row. if going totally destroys outcome:
before update:
after update:
as 1 can see in generated html, not rerender tr
, td
tags, appears in first "column" of table:
work around:
- wrap content of each cell in container , update containers individually (this works fine, quite ugly have know implemention details of each row in other one)
update:
the comments far have been helpful. able to update single row without need having knowledge internal structure. replaced id of row styleclass attribute , added styleclass attribute input component well.
<p:row styleclass=#{rowid}> <p:column> <some:inputcomponent styleclass="foo"> <p:ajax update="@(.#{toupdate} .mysuffix)" /> </some:inputcomponent> </p:column> </p:row>
as said, works fine if toupdate
caintains 1 single "id", want able update more 1 row in way. use component this:
<p:panelgrid> <my:row value=#{foo} rowid="one" /> <my:row value=#{bar} rowid="two" /> <my:row value=#{fobar} rowid="three" toupdate="one two"/> </p:panelgrid>
(as more related jquery now, added jquery tag on question well.)
solution:
the final approach looks that:
<c:set var="u" value="#{empty parentids ? parentids : of:concat(fn:join(fn:split(toupdate,' '), ' .mysuffix,'),' .mysuffix')}" /> // .... update="@({u})"
it quite close kukeltjes suggestion, problem join not append styleclass after last value. caused problems when no ids passed.
Comments
Post a Comment