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 6599449
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:29:33+00:00 2026-05-25T18:29:33+00:00

I would like to use jqGrid for a great many grids that have only

  • 0

I would like to use jqGrid for a great many grids that have only a small set of application-specific column types, and I would like to create a way to enforce consistency. For example, I want all my columns that show the compliance status of a row to have a certain format, be aligned a certain way, have specific search options, etc. So instead of having a colmodel entry like this:

{ name: 'ABC', width: 80, align: 'center', stype: "select", 
              searchoptions: { value: "1:Compliant;0:Not Compliant"} }

I would like to have one like this:

{ name: 'ABC', width: 80, mytype: compliancestatus }

where compliancestatus is a function I would write.

Is this kind of thing possible – without modifying the jqGrid source code? If so, can someone point me to an example of this type of extension?

  • 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-25T18:29:33+00:00Added an answer on May 25, 2026 at 6:29 pm

    Since jqGrid 3.8.2 are column templates supported.

    You can just define for example

    var compliancestatus = {
            width: 80,
            align: 'center',
            stype: "select", 
            searchoptions: { value: "1:Compliant;0:Not Compliant" }
        };
    

    somewhere in the scope of visibility and then just use in colModel

    { name: 'ABC', template: compliancestatus }
    

    In the template you can include any parameters. If the column definition has the same property but with the same value like

    { name: 'ABC', width: 100, template: compliancestatus }
    

    the value from the colModel (width: 100 in the case) will be used.

    I suggested the feature some time before and I use it intensively myself. For example I have many grids having many columns with checkboxes. I use the following template in the case:

    mySettings.templateCheckbox = {
        formatter: 'checkbox', align: 'center', width: 20,
        edittype: 'checkbox', editoptions: { value: "1:0" },
        stype: "select", searchoptions: { sopt: ['eq', 'ne'], value: ":Any;1:Yes;0:No" }
    };
    

    In the same way I defined many other templates which reduce the code of grids and improve managing of the common grid style.

    If you want to change some common default settings for all columns you can use cmTemplate parameter of jqGrid. For example

    cmTemplate: { align: 'center' }
    

    You can use it as additional parameter of jqGrid or set it like any other default parameter with respect of

    $.extend($.jgrid.defaults, {
        cmTemplate: { align: 'center' }
    });
    

    Read more about the column templates here.

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

Sidebar

Related Questions

I have an array of Integers in Java, I would like use only a
I currently have some large strings that I would like use as test data
I have a grid that is currently using Telerik Grids, I would like to
I would like use a panel whose children have coordinates specified as percentage of
I have a jqGrid in my project and I would like to add custom
I would like use argparse to parse the arguments that it knows and then
I would like to use a language that I am familiar with - Java,
I would like to use a component that exposes the datasource property, but instead
I hope you have a good morning. I'd like to use jqGrid in my
I would like to use ovi maps in offline mode in one application for

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.