• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

modifying UI components on page with event handler

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
doh. Thanks. I feel silly now.
 
reply
    Bookmark Topic Watch Topic
  • New Topic