This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSF and the fly likes Send Ajax request to refresh dataTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Send Ajax request to refresh dataTable" Watch "Send Ajax request to refresh dataTable" New topic
Author

Send Ajax request to refresh dataTable

naveen gupta
Ranch Hand

Joined: Apr 12, 2006
Posts: 129
I have a dropdown and a dataTable in the page

everytime i change value in the dropdown, i have to hide dataTable in the page, which is NOT working

what i observed is that change in the value for drop down, i can send ajax request only to hide and display individual components like textbox

what it's not working for the dataTable

It MIGHT work(i am not sure, still haven't tried), if i use a4jutputPanel, but if i use this one then for every ajax request in that page refreshes the dataTable, which i don't want
Brendan Healey
Ranch Hand

Joined: May 12, 2009
Posts: 218
What it sounds like you should be doing is updating the datatable based upon the selection
from the menu, i.e. select Department A, get list of employees from department A. I don't
get the show/hide thing, this sounds like a javascript hangover.

Do something like this:



Try this.

Brendan.
naveen gupta
Ranch Hand

Joined: Apr 12, 2006
Posts: 129
after selecting the value from dropdown, i will click on "Search" button to show the list in dataTable
I am displaying the results only after clicking on the search button and not after selecting the value in drop down


What i want to do is send ajax request based on the change of value selected from dropdown
and the ajax request basically hides the dataTable

Brendan, you understood correctly

But your solution is not working for me ( i am using RichFaces for your information )
naveen gupta
Ranch Hand

Joined: Apr 12, 2006
Posts: 129
it resolved. Following is the code

<a4jutputPanel id="dataRegion" ajaxRendered="true" >
<rich:panel rendered="#{rTestBean.pclist}">

</rich:panel>
</a4JutputPanel>


The mistake i was doing was

<a4jutputPanel id="dataRegion" ajaxRendered="true" rendered="#{rTestBean.pclist}">
<rich:panel >

</rich:panel>
</a4JutputPanel>
Brendan Healey
Ranch Hand

Joined: May 12, 2009
Posts: 218
[I wasn't correct as it turns out - the last reply wasn't there when I typed this in]

Ok, I think I know what the problem is:



You are not including execute= for the selectOneMenu, am I correct?
This is only a guess as you've not posted any code.

Regards,
Brendan.
naveen gupta
Ranch Hand

Joined: Apr 12, 2006
Posts: 129
hhhmm......

you are using JSF 2.0 and i am using JSF 1.2, so for AJAX functionality i am using RichFaces

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Send Ajax request to refresh dataTable
 
Similar Threads
Drop Down Menu Using AJAX and JSP
Dropdown populating dropdown
Drop down Menu, Option,value
Populating child menu based on parent menu in datatable
how to populate the dropdown using javascript