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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:16:22+00:00 2026-06-08T17:16:22+00:00

$(#tableVisualization).jqGrid(‘GridUnload’); $(#tableVisualization).jqGrid({ datatype: local, mtype: ‘GET’, colNames: this.GetGridColumnNames(), colModel: this.GetGridColumnModel(), height: 100%, autowidth: true,

  • 0
$("#tableVisualization").jqGrid('GridUnload');

$("#tableVisualization").jqGrid({
    datatype: "local",
    mtype: 'GET', 
    colNames: this.GetGridColumnNames(),
    colModel: this.GetGridColumnModel(),
    height: "100%", 
    autowidth: true,
    shrinkToFit: true,
    sortname: 'monthID', 
    sortorder: "desc", 
    rowList: [6, 12], 
    rowNum: 12,
    pager: $('#pager3'), 
    viewrecords: true, 
    recordpos: "left", 
    caption: "Table" 
});

//local data array used for example
var data = this.GetGridData();

//FUNCTION CALL
//populate grid with data
$("#tableVisualization").jqGrid("addRowData", "month", data);

$("#tableVisualization").trigger("reloadGrid"); 

$("#tableVisualization").setGridWidth(1040, true);

Above code works fine.

However if I assign $("#tableVisualization") to a variable and use the variable in the above code it does not work.

//var grid = $("#tableVisualization");

It works every alternate call.

For example if the whole code was inside a javascript method called LoadGrid(), then the first call to the method works, second call does not, third works, fourth does not and so on.

I have seen during debugging, when it reached “grid.jqGrid('GridUnload')” on the even calls, the grid is completely removed(im not sure if the html table is removed or not) and it is not created during "$("#tableVisualization").jqGrid({.....});".

Can anyone please explain me the reason for this behaviour.

I can make the scenario work because now I am not using a local variable but I would like to know why it does not work?

  • 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-08T17:16:27+00:00Added an answer on June 8, 2026 at 5:16 pm

    We can see exactly what is going on within the grid’s GridUnload method in grid.custom.js:

    GridUnload : function(){
        return this.each(function(){
            if ( !this.grid ) {return;}
            var defgrid = {id: $(this).attr('id'),cl: $(this).attr('class')};
            if (this.p.pager) {
                $(this.p.pager).empty().removeClass("ui-state-default ui-jqgrid-pager corner-bottom");
            }
            var newtable = document.createElement('table');
            $(newtable).attr({id:defgrid.id});
            newtable.className = defgrid.cl;
            var gid = $.jgrid.jqID(this.id);
            $(newtable).removeClass("ui-jqgrid-btable");
            if( $(this.p.pager).parents("#gbox_"+gid).length === 1 ) {
                $(newtable).insertBefore("#gbox_"+gid).show();
                $(this.p.pager).insertBefore("#gbox_"+gid);
            } else {
                $(newtable).insertBefore("#gbox_"+gid).show();
            }
            $("#gbox_"+gid).remove();
        });
    },
    

    The key points to understand are:

    • A new table element is inserted with the same DOM id as the old table. We can see it created in the call to document.createElement('table') and inserted in one of the calls to insertBefore.
    • The existing jqGrid DOM is removed in the call to $("#gbox_"+gid).remove(). Since the old table element is contained within the gbox, it is removed as well.

    After the call to GridUnload, the DOM element that it refers to no longer exists on the page, so any code that references the element is ineffective.

    Does that help?

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

Sidebar

Related Questions

I have a DataTable object that contains all the data for a Table visualization.
I am using Google visualization api. Following is my sample code. Either of the

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.