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

  • Home
  • SEARCH
  • 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 7019185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:09:01+00:00 2026-05-27T23:09:01+00:00

I have the caption parameter set in the jqGrid definition. I want to know

  • 0

I have the caption parameter set in the jqGrid definition. I want to know if there’s a way to set it dynamically depending on the class attribute of the table element to which the jqGrid plugin is attached.

HTML 1

<table id="myjqgrid" class="view"></table>
<div id="Pager"></div>

HTML 2

<table id="myjqgrid" class="edit"></table>
<div id="Pager"></div>

JQGrid Definition

$("#myjqgrid").jqGrid({
    caption: ""     // this is what I want to set dynamically
})
  • 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-05-27T23:09:01+00:00Added an answer on May 27, 2026 at 11:09 pm

    You can use setCaption method to set new caption on the grid:

    var $grid = $('#myjqgrid');
    $grid.jqGrid('setCaption', 'newCaption');
    

    If you need to set the caption depend on the class of the <table> element the code can be like the following

    if ($grid.hasClass('edit')) {
        $grid.jqGrid('setCaption', 'Edit Caption');
    } else if ($grid.hasClass('vew')) {
        $grid.jqGrid('setCaption', 'View Caption');
    } else {
        $grid.jqGrid('setCaption', 'Default Caption');
    }
    

    The only thing which you can’t do with respect of setCaption method is to remove (to hide) the caption: the results which you have if you created grid without caption parameter (or with caption: ""). To remove (to hide) the caption you can do

    $(">div.ui-jqgrid-titlebar", $grid.closest('div.ui-jqgrid-view')).hide();
    

    or

    $($grid[0].grid.cDiv).hide();
    

    (see the answer for details).

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

Sidebar

Related Questions

Is there any way to have a default MessageBox.Show() caption? Let says I would
I have a problem. I want to copy a caption of a label from
I have a LaTeX table that looks like this: \begin{table}[!ht] \centering \small \caption{ \bf{Caption}}
I have a table with rowID, longitude, latitude, businessName, url, caption. This might look
I have a JQGrid plugin in my website, the table is loading OK, but
I have a custom table-environment defined with \newenvironment. I have a caption in this
My button is set to size as needed (wrap_content); it does have a caption,
Whenever I attempt to create a wallpost that doesn't have the caption set it
Here's what I want to do. I have a caption that changes every time
I have a caption for a GUI control, and I want to convert it

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.