aspose file tools*
The moose likes Groovy and the fly likes Displaying Data Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Languages » Groovy
Bookmark "Displaying Data " Watch "Displaying Data " New topic
Author

Displaying Data

Harjit Singh
Ranch Hand

Joined: Feb 01, 2007
Posts: 77
Hi there,

I have a gsp page which I developed using Grails. I have a dropdown list at the top of the page which acts as a filter. I need to display the data using that filter value. How can I do that ?
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Several ways:

1. Have a button you can click that submits a form to the server with the filtered item and return an appropriate response
2. Use JavaScript to create an onChange event that then posts the form back to the server
3. #2 but use ajax for the post, sending back an appropriate response.

Are you having any specific issues or is this a general question?


GenRocket - Experts at Building Test Data
Harjit Singh
Ranch Hand

Joined: Feb 01, 2007
Posts: 77
I'm having specific issues. Is there any way to submit the form with the use of an dropdown list or clicking of a check box in Grails. I want to avoid too many clicks to see the data.

Thanks

- Harjit
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

#2/#3 in my previous post or add a click event using Javascript to the checkbox to submit the form. None of this is Grails specific. It's just HTML/JavaScript. Can you tell us the specific issues you mention?
Harjit Singh
Ranch Hand

Joined: Feb 01, 2007
Posts: 77
here is what is happening. I had written the stuff using the <select tag and using the remotefunction in the onchange attribute. For some reasons when I update my div it actually duplicated the navigation bar.

><select id="dd"
onchange="${remoteFunction(
controller:'fnmWeeklyStatus',
action:'listall',
update:'tasklist',
before:'removeElementBefore(\'tasklist\')',
params: '\'id=\'+ this.value',
onComplete='testFailure()')}">
<option value=""></option>
<option value="ShowAll">ShowAll</option>
<option value="Mine">Mine</option>

</select>

I don't know why that's happening. I tried to take a look at the DOM and I couldn't find the references to the duplicate nav bar in the DOM and hence I wanted to see if there is any other route to take.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

You're probably seeing the duplicated nav bar because you are returning a response that includes it. Without seeing your controller code, this is just a guess, but if you are rendering a GSP as the response, it is going to pick up the layout, which includes the navbar. You should be rendering a template instead.
Harjit Singh
Ranch Hand

Joined: Feb 01, 2007
Posts: 77
I'm controller includes the standard code for what a typical list method would output. It just returns a map of all the instances and the total. Couple of questions

1) How do I log what I'm getting from response ?
2) How can I just render the template ?

Thanks for your help.

- Harjit
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

1) Um, you're web page should be the response, so this is how you would know what that is.

2) http://www.grails.org/Tag+-+render



Note, that template filenames begin with an underscore. So you're file name would be _someTemplate.gsp.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Displaying Data