0

I have this structure:

<h:dataTable id="baselist">
   <h:dataTable id=childlist">
       <p:commandLink update="should only update childlist">
   </h:dataTable>
</h:dataTable>

I've tried everything I can think of, but I only get errors saying that the childlist can not be found. Is it not possible to update this way?

nivis
  • 913
  • 3
  • 17
  • 34

2 Answers2

0

Note that the there is an index number included in the id of the childlist datatable.

eg.:

the id of the childlist table in the first row of the parent table is: :form:baselist:0:childlist

the id of the childlist table in the second row of the parent table is: :form:baselist:1:childlist

the id of the childlist table in the third row of the parent table is: :form:baselist:2:childlist

and so on...

Solution:

Update the parent table so everything gets updated and synchronized including childlist tables in all the rows

eg.

update=":form:baselist"

Unrealated:

You can see the full qualified id of your elements by right clicking your rendered page in the browser and view page source.

fareed
  • 3,034
  • 6
  • 37
  • 65
  • Yes, I've tried that and it works; my question though, is why I'm not able to only update the child table. I've tried: `@parent` which does not update anything it would seem; and also the full qualified path which gives the exception about the id not possible to find, even though I can see it's correct. – nivis Oct 24 '13 at 09:09
0

You may can try using #{component.parent.clientId} but you wouldn't be gaining as much as you think.

JSF will typically rebuild the whole structure see answer in: Does Facelets rebuild the whole page if Ajax is trigger from a form and updates another?

In addition, if you have modified baselist, then you will get into problems as the :0,:1 namingcontainer ids will become inconsistent. e.g. if you remove the first element from baselist, JSF will rebuid the view with new ids. so :form:baselist:1:childlist' will become :form:baselist:0:childlist etc.

I am not sure if you 'll get an error but for sure this will cause some pain sooner or later.

Community
  • 1
  • 1
Ioannis Deligiannis
  • 2,679
  • 5
  • 25
  • 48