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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T13:42:24+00:00 2026-06-01T13:42:24+00:00

I was going through the documentation and source code of jqGrid 4.3.1 when it

  • 0

I was going through the documentation and source code of jqGrid 4.3.1 when it comes for the tableToGrid() function and I found that the ColModel and ColNames are ignored when included in the options object as they are constructed from HTML table layout.

My question is there a way to force tableToGrid() to accept those two arrays (ColModel,ColNames) rather than construct them out of the HTML table, especially if the the table columns are known in advance.

When I went through the code, I found this portion in the code for TableToGrid

function tableToGrid(selector, options) {
...
...
// Build up the columnModel and the data
var colModel = [];
var colNames = [];
jQuery('th', jQuery(this)).each(function() {
    if (colModel.length === 0 && selectable) {
        colModel.push({
            name: '__selection__',
            index: '__selection__',
            width: 0,
            hidden: true
        });
        colNames.push('__selection__');
    } else {
        colModel.push({
            name: jQuery(this).attr("id") || jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(' ').join('_'),
            index: jQuery(this).attr("id") || jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(' ').join('_'),
            width: jQuery(this).width() || 150
        });
        colNames.push(jQuery(this).html());
    }
});

However, my hack would consider these changes

    function tableToGrid(selector, options) {
...
...
// Build up the columnModel and the data
if(options.hasOwnProperty("colModel") && options.hasOwnProperty("colNames")) {
    var colModel = options.colModel;
    var colNames = options.colNames;
} else {
    var colModel = [];
    var colNames = [];
    jQuery('th', jQuery(this)).each(function() {
                    if (colModel.length === 0 && selectable) {
                    colModel.push({
                    name: '__selection__',
                    index: '__selection__',
                    width: 0,
                    hidden: true
                    });
                    colNames.push('__selection__');
                    } else {
                    colModel.push({
                    name: jQuery(this).attr("id") || jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(' ').join('_'),
                    index: jQuery(this).attr("id") || jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(' ').join('_'),
                    width: jQuery(this).width() || 150
                    });
                    colNames.push(jQuery(this).html());
                    }
    });
}

I just would like to know if there’s an easier way (may be an option I missed) that would enforce such behaviour without the need to adjust the source code.

The reason I am doing this in the first place is to force the datefmt option for some of the fields as they are ignored by the jQgrid causing issues with the search functionality. If @Oleg can give some insight about this, it will highly appreciated.

Cheers, N.

  • 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-01T13:42:26+00:00Added an answer on June 1, 2026 at 1:42 pm

    I think the main your problem is that you use tableToGrid at all. I find the question about the common usage or architecture as technical question.

    If you have typed data like numbers, dates, currency and so on you want probably that the data will be correctly sorted, by jqGrid for example. Parsing of localized data from the HTML table and unformatting of the data is not the best way. You save your time if you would create jqGrid directly. You should provide the input data in data parameter. In the way the data will be easy and safe read, sorted and paged. You can easy include toolbar filtering or advanced searching or some other searching of filtering. All will good work only if you will provide jqGrid pure data.

    See the answer for more information.

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

Sidebar

Related Questions

I was going through hibenate documentation and found that it is possible to return
Going through Javascript documentation, I found the following two functions on a Javascript object
I was going through the spark view engine documentation and found a lot of
Going through the documentation of the SDF, i found many classes like the BitmapEx
I was going through the CodeIgniter documentation and this bit of code confuses me
I'm going through the Intel processor documentation and writing some basic assembly code at
I was looking through the documentation and source code, because I wanted to be
Going thorugh overflow function documentation. I found overflow has following as return values. Return
I was going through some ECLiPSe documentation and found this: `nonvar/1` : Fails if
Going through some documentation on modifying CGImageRef data, I came across a strange example

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.