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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:23:37+00:00 2026-05-28T13:23:37+00:00

I have the following JQ-Grid with a formatter function which returns some HTML as

  • 0

I have the following JQ-Grid with a formatter function which returns some HTML as the column value:

jQuery("#list").jqGrid({ 
      url:jsonUrl, 
      datatype: 'json', 
      mtype: 'GET', 
      colNames:['Id', 'Name', 'Phone', 'Action'], 
      colModel :[ 
         {name:'id', index:'id', sortable:true}, 
         {name:'name', index:'name', sortable:true},
         {name:'phone', index:'phone', sortable:false},

         {name:'details', index:'details', sortable: false,
              formatter:function(cellvalue,options,rowObject){
                  return "<p class='trigger'><a href='#'><img src='/images/actions.jpg' /></a></p><div class='toggle_container'><div class='block'><table class='action'><tr><td><a href='#'><img src='/images/open.gif' /></a></td><td><a href='#'><img src='/images/edit.gif' /></a></td><td><a href='#'><img src='/images/delete.gif' /></a></td></tr></table></div></div>"
              }
          }
         ] 

Later on, I try to get all the column / row data and export it to Excel. Is there a feature in JQ-Grid which allows you to export in Excel / PDF (fyi – I am using JSP/JAVA).

When I try to do something like this:

 var mya=new Array();
 mya=$("#list").getDataIDs();  // Get All IDs
 var data=$("#list").getRowData(mya[0]);     // Get First row to get the labels

I get a JavaScript error:

 Message: 'l.p.colModel[...].name' is null or not an object
 URI: http://www.ok-soft-gmbh.com/jqGrid/jquery.jqGrid-4.1.2/js/jquery.jqGrid.min.js
  • 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-28T13:23:38+00:00Added an answer on May 28, 2026 at 1:23 pm

    I think I may have an answer to your problem – or at least a workaround that will suffice. Take a look at the javascript below. This is the approach I use for ripping the data out of the grid:

    var sCell;
    var aDataIDs = $Grid.getDataIDs();
    
    //Loop through table rows
    for (var i = 0; i < aDataIDs.length; i++) {
    
      try {
        //Get row
        var oRow = $Grid.getRowData(aDataIDs[i]);
    
      }
      catch (e) {
        //If problem then fall back to this
        for (var j = 0; j < _oJQGUserSettings.aColModel.length; j++) {
          if (j > 0) sb.append('\t'); //Add tab
    
          //Get cell data
          sCell = $Grid.getCell(aDataIDs[i], _oJQGUserSettings.aColModel[j].name);
    
          sb.append(sCell);  //Add data
        }
      }
    

    If you bear in mind that sb is a javascript stringbuilder class and _oJQGUserSettings.aColModel is just my encapsulation of the ColModel then this should probably give you what you need in terms of extracting the data from the grid as required. (I then copy it to the clipboard which allows me to paste the contents of the grid straight into Excel – handy!)

    I suspect there is a bug in getRowData which is thrown when not all columns are displayed to the user. However I haven’t isolated this for sure as yet.

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

Sidebar

Related Questions

Suppose I have the following (shortened for simplicity): jQuery(#grid).jqGrid({ ... ondblClickRow: function() { //
Suppose I have the following (shortened for simplicity): jQuery(#grid).jqGrid({ ... ondblClickRow: function(rowid) { //
We have a grid with datatype json. We have the following custom formatter: function
We have a web part on which we display some data in a grid.
I have the following simpl WPf grid, two columns, a button in each column,
In Index.cshtml I have the following: @{ Html.Telerik().Grid<hekomaseru.Models.testdbEntities1>(testtable) .Name(grid1) .Pageable() .Sortable() .Filterable() .Groupable() .Render();
I have following WPF ListView: <ListView Grid.Column=2 Grid.Row=1 Margin=0,53,12,6 Name=lvwProperties ItemsSource={Binding Path=SelectedPropertyItems, Mode=TwoWay} Grid.ColumnSpan=2>
I have the following XAML inside a 4 Row by 2 column grid. The
I have the following border in XAML: <Border Grid.Column=0 Grid.ColumnSpan=3 Grid.RowSpan=3 CornerRadius=1,1,1,1 Background=Red BorderBrush=#333333
I have a small testview in Silverlight which consists of the following grid: <Grid

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.