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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T20:52:07+00:00 2026-05-29T20:52:07+00:00

how can I set a css class to the element jqgrid creates by using

  • 0

how can I set a css class to the element jqgrid creates by using edittype: select? Here is my code:

$(window).load(function () {
            GetProjects();
        });

        function GetProjects() {
            jQuery("#tbl1").jqGrid({
                url: 'myurl',
                datatype: "json",
                mtype: 'POST',
                colNames: ['Project', 'Module', 'Description'],
                colModel: [
        { name: 'Project', index: 'Name', width: 90, editable: true, edittype: 'select', editoptions: { value: GetProjectOptions()} },
        { name: 'Name', index: 'Project.Name', width: 55, editable: true },
        { name: 'Description', index: 'Description', width: 90, editable: true }
    ],
                rowNum: 10,
                rowList: [10, 20, 30],
                pager: '#nav1',
                sortname: 'Project.Name',
                viewrecords: true,
                sortorder: "desc",
                caption: "DDS Project Modules",
                jsonReader: {
                    repeatitems: false,
                    root: function (obj) { return obj; }
                },
                width: '500',
                loadonce: true,
                hidegrid: false,
                editurl: 'myurl'
            });
            jQuery("#tbl1").jqGrid('navGrid', '#nav1', { edit: false, add: false, del: false });
        }

        function AddRow() {
            jQuery("#tbl1").jqGrid('editGridRow', "new", { reloadAfterSubmit: false, closeAfterAdd: true });
        }

I’ve tried using classes: ‘cssClass’ in the colModel but that didn’t work.
Here is how the html is created:

<select name="Project" class="FormElement" id="Project" role="select" size="1">

Any suggestions? Thanks in advance!

  • 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-29T20:52:11+00:00Added an answer on May 29, 2026 at 8:52 pm

    You can define dataInit method of the editoptions. For example you can try the following code

    editoptions: {
        value: GetProjectOptions(),
        dataInit: function (elem) {
            $(elem).addClass('ui-state-highlight');
        }
    }
    

    The result will be like the following:

    enter image description here

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

Sidebar

Related Questions

How can I set the background color of an HTML element using css in
I'm trying to set opacity of element by jQuery. $('[class*=OtherFeatur]').load(function(){ $(this).fadeTo(500, 0.5); }); is
Here is a problem: i need to select elements on page by css class,
I have an element on a page with background image set using css: //
Can I set a different background-image CSS attribute to my <BODY> tag depending on
I can't seem to find where to specify the CSS class of the list
Sometimes I find myself creating a CSS class for a single element. So instead,
I can set the PHP include path in the php.ini : include_path = /path/to/site/includes/
I can set data in JTable constructor, and then user can change this data
I can set the minimum version required (for example XP SP3) in Inno-Setup by

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.