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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:33:37+00:00 2026-05-27T17:33:37+00:00

I am inserting a div element between the jqgrid titlebar and table headers using

  • 0

I am inserting a div element between the jqgrid titlebar and table headers using loadComplete event.

HTML Code

<div class="userinfo">
   <table id="myjqgrid"></table>
   <div id="Pager"></div>                   
   <script src="js/myjqgrid.js" type="text/javascript"></script>
</div>

JSON

{
    "mypage": {
        "outerwrapper": {
            "page":"1",
            "total":"1",
            "records":"1",
            "innerwrapper": {
                "rows":[
                    {
                        "id":"1",
                        "cells":
                        [               
                            {
                                "value":"12345",
                                "label": "ID"                       
                            },
                            {
                                "value":"David",
                                "label": "FirstName"    
                            },
                            {                           
                                "value":"Smith",
                                "label": "LastName"                         
                            }                                                                                       
                        ]       
                    },
                    {
                        "id":"2",
                        "cells":
                        [               
                            {
                                "value":"37546",
                                "label": "ID"                       
                            },
                            {
                                "value":"Willy",
                                "label": "FirstName"    
                            },
                            {                           
                                "value":"Peacock",
                                "label": "LastName"                         
                            }                                                                                       
                        ]       
                    },
                    {
                        "id":"3",
                        "cells":
                        [               
                            {
                                "value":"62345",
                                "label": "ID"                       
                            },
                            {
                                "value":"Kim",
                                "label": "FirstName"    
                            },
                            {                           
                                "value":"Holmes",
                                "label": "LastName"                         
                            }                                                                                       
                        ]       
                    },
                    {
                        "id":"4",
                        "cells":
                        [               
                            {
                                "value":"186034",
                                "label": "ID"                       
                            },
                            {
                                "value":"Andy",
                                "label": "FirstName"    
                            },
                            {                           
                                "value":"Wills",
                                "label": "LastName"                         
                            }                                                                                       
                        ]       
                    }
                ]
            }
        }
    }
}

JQGrid Definition (myjqgrid.js)

$(function (){
    var getValueByName = function (cells, cellItem) {
        var i, count = cells.length, item;
        for (i = 0; i < count; i += 1) {
            item = cells[i];
            if (item.label === cellItem) {
                return item.value;
            }
        }
        return '';
    };
    $("#myjqgrid").jqGrid({
        url: "myjqgrid.json",
        datatype: "json",
        contentType: "application/x-javascript; charset=utf-8",
        colNames:['ID','FirstName', 'LastName'],
        colModel:[
            {name:'ID',index:'ID',jsonmap:function(obj){return getValueByName(obj.cells, "ID");}, width:150, align:"center"},
            {name:'FirstName',index:'FirstName',jsonmap:function(obj){return getValueByName(obj.cells, "FirstName");}, width:150, align:"left", sortable:true},
            {name:'LastName',index:'LastName',jsonmap:function(obj){return getValueByName(obj.cells, "LastName");}, width:150, align:"left", sortable:true}         
        ],
        jsonReader: {
            root: "mypage.outerwrapper.innerwrapper.rows",          
            page: "mypage.outerwrapper.page",
            total: "mypage.outerwrapper.total",
            records: "mypage.outerwrapper.records",
            repeatitems: false
        },
        rowNum:2,
        rowList:[2, 4],
        pager: '#Pager',
        recordpos: 'left',
        multiboxonly:true,
        viewrecords: true,
        sortorder: "desc",
        multiselect: true,
        scrolloffset: 0,    
        loadonce: true,     
        sortable: true, 
        sorttype: "text",
        cache: true,
        height: "auto",
            caption: "MY JQGRID",
        loadComplete: function(){
            $("<div>Table Summary</div>").insertAfter("#gview_myjqgrid .ui-jqgrid-titlebar");
        }
    });
    $("#myjqgrid").jqGrid('navGrid','#Pager',{add:false,del:false,edit:false,position:'right'});
});

Problem

The extra div element is getting displayed. BUT each time I navigate from 1 page to another, it draws an extra div.

  • So, when the page loads I get 1 div that reads ‘Table Summary’.
  • Then I navigate from page 1 to page 2, I get 2 div elements that read ‘Table Summary’.
  • I navigate back from page 2 to page 1, I get 3 div elements that read ‘Table Summary’
  • 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-27T17:33:37+00:00Added an answer on May 27, 2026 at 5:33 pm

    You should better use

    toolbar: [true,"top"]
    

    parameter of jqGrid to add empty div. If you do need to add the dive manually you should move the code $("<div>Table Summary</div>").insertAfter("#gview_myjqgrid .ui-jqgrid-titlebar"); out of loadComplete. You should place the code after creating of the grid (after $("#myjqgrid").jqGrid({...});).

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

Sidebar

Related Questions

I am using Edit Html in firebug and inserting the following bit of code:
Basically I am inserting an image using the listviews inserting event, trying to resize
i have following code for inserting another page into div An XHTML 1.0 Strict
So, I've encountered a situation where inserting an element of a different class/id breaks
I'm inserting an element into a contentEditable div but the browser sets the position
I would like to load a table element from another HTML (additional_content.html) into the
I have a HTML Table which in which i want to manipulate using JQuery
I have a content editable div. Within this I am inserting a <pre>some code</pre>
I have the following HTML: <div class="selfClear" style="float: left; border: 1px solid black;"> ...floated
I'm using Zend_Form for an application form using this code: class Form_ApplicationForm extends Zend_Form

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.