Skip to main content

with h:commmandButton

3 replies [Last post]
capitanu
Offline
Joined: 2009-10-19

Hello.
I'm trying to create a dynamic table (similar with FlexTable from GWT): have a table grid, and under the table grid a text box and an add button. When the user enters a text and hits add the text has to be added to the table. My code is partially working (first time a text is added it does not appear in the table, the when the second text is added the first one appears in the table, and so on). Here is my code that does this:

The problem is that the panelGrid is refreshed for the blur event of inputText, but I only add the team to the panel on click, and then the panel does not refresh. I am new to JSF 2.0 so maybe I am missing something.

Thanks,
George

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
driscoll
Offline
Joined: 2003-06-06

I'm not entirely sure what you're trying to do here, but here's a few things I notice off the bat:

No, the PanelGrid isn't going to be refreshed by the inputText - because there isn't a render="teamsGrid". But it will be rendered if the button is clicked - except that then the inputText won't be executed - except that it got executed via the blur first.

So, it should work, but it's a shaky foundation that I wouldn't recommend. Why use the blur at all? Leaving that off is probably going to make better code.

And, lastly, I've generally steered clear of c:forEach, because then I don't have to worry about this:
http://www.ilikespam.com/blog/c:foreach-vs-ui:repeat-in-facelets

But prehaps your problem is somewhere else entirely, it's hard to tell.

capitanu
Offline
Joined: 2009-10-19

Thanks for the response. The reason why I had that blur event was so that the value entered would be saved to the model, so when I was clicking (originally a h:graphicImage) the value entered would have been already saved to the model. I did not know of the execute option. This code does what I originally wanted to achieve:

capitanu
Offline
Joined: 2009-10-19

Stange that it did not paste my code: Let me try again