Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Displaying Data

 
Harjit Singh
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Harjit Singh
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
#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
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic