Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9194291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:22:37+00:00 2026-06-17T21:22:37+00:00

What would be the best way to display data from Grails database in JQuery

  • 0

What would be the best way to display data from Grails database in JQuery UI tabs? What I would like is to have a tab interface and on each tab is a list of the records from a different domain. For instance, Tab1 displays the record list from Domain1, Tab2 displays the record list from Domain2, etc.

I have the JQuery UI tab interface set up and working and am currently using createLink to call the method from the controller to return the model of the appropriate domain. The tabs look like this:

<div id="tabs">
    <ul>
        <li><a href="${createLink(action: 'listHardware')}">Hardware records</a></li>
        <li><a href="${createLink(action:'listModel')}">Model records</a></li>
        <li><a href="${createLink(action:'listBuilding')}">Building records</a></li>

    </ul>       
</div>

The method from the controller looks like this:

def listHardware() {
    [hardwareList:Hardware.list(), hardwareInstanceTotal:Hardware.count()]      
}

I’ve also played around with rendering a whole GSP within the tab by using “render(view:’HardwareList’, model:[hardwareList:Hardware.list(), hardwareInstanceTotal:Hardware.count()]”, but that takes a VERY long time (at least 5 seconds) to load each time the tab is selected and is not at all ideal, especially if it were to take that long for each tab.

UPDATE

As noted in one of my answers to Rimero’s answer below, I was able to use templates to display tables of my domains’ data. I’m also trying to implement pagination on each tab using the tag, but each time I click on one of the pages to view another page, it takes me to the full template itself outside of the tab interface. Any thoughts on how to format the tag so that everything stays within the tab??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T21:22:38+00:00Added an answer on June 17, 2026 at 9:22 pm

    Here’s my suggestion:

    • You can fetch everything at once in your controller in your index method for example.
    • You can implement your tab contents as templates
      (g render template). Each tab == 1 template.
    • You can fetch your domain objects buildingList,
      etc. from the index method of your controller.
    • The g:render template code for each tab may only need to be passed a map or a collection for rendering.

    In this case you don’t need hyperlinks to controllers endpoints. You just keep anchors to the tab(div id) as in the default example here -> http://jqueryui.com/tabs/.

    UPDATED ANSWER

    As you said that sending all the data at once takes a long time, you could fetch it asynchronously. If possible populate the data only for the first tab directly.

    • Create a business method for each tab, that will return the model as JSON, data is only fetched if not already retrieved from the server (Need to keep state or see for example if the tab id has some DOM nodes.

    • Using JQuery, when the DOM is ready, get the current tab and if you didn’t fetch the data for the first tab eagerly, fetch it at this moment with the busy image spinning.

    • As soon as you select a new tab, you need to check if the data was already fetched, if not, you send an ajax call and your callback function populate the data in the tab div container for example.

    Hope it helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to display data from a database onto a content page using
What would be the best way to display a dialog whenever my app receives
I want to make a code snippet database web application. Would the best way
What would be the best way to something like this where a timestamp is
I would like to know what is the best way to pass a large
I have a view and I want to display data that would be generated
I am plotting data from an aircraft on a map and I would like
I would like to pull data from my server and add to a table
postgres 9.2 supports json columns. what would be best way to extend postgres to
What would be the best way to version a rails application? We want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.