• Post Reply Bookmark Topic Watch Topic
  • New Topic

modifying UI components on page with event handler

 
Chad Foor
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a situation where I have an index.jsp with teh following declarations:

<h:datatable id="tiger" rows="10" ...>
...
</h:datatable>

<h:commandButton id="alterMe" actionListener="#{myForm.togglePagination}"/>

In the backing bean, I have the code for the actionListener as follows:

void togglePagination(ActionEvent e)
{


}

What I'm trying to do is modify the <h:dataTable> element from the command button declared in the actionListner to re-set the rows="10" to something else.

Ideally, get a reference to something like:

HtmlDataTable myPointer = (HtmlDataTable)e.getComponent.getAttributes("tiger");
myPointer.Rows = 80;

or some variation. I can find the id of the command button easily enough, but in this case the command button is a sibling of the datatable element as it's laid out on the page. (It's not a child declared inside.)

How might I go about setting this up ?

Apprciate any advice.

Thanks,
Chad
 
Tim Holloway
Bartender
Posts: 18408
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you can simply set the rows attribute dynamically, That is:

rows="#{tableBean.displayRowCount}"

If your command process modifies this property then when the page is redisplayed, it should be automatic.
 
Chad Foor
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
doh. Thanks. I feel silly now.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!