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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:10:22+00:00 2026-06-14T11:10:22+00:00

I m new about JqGrid. I use following code to grid my data: <script

  • 0

I m new about JqGrid. I use following code to grid my data:

<script type="text/javascript">
jQuery(document).ready(function () {
    jQuery("#grid_table").jqGrid({
        url: '@Url.Action("GetAll", "Widget")',
        datatype: "json",
        mtype: 'POST',
        colNames: ['ReadDate', 'Name'],
        colModel: [
            { name: 'ReadDate', index: 'ReadDate', width: 200, sortable: true, editable: false, editoptions: { readonly: true, size: 10} },
            { name: 'Name', index: 'Name', width: 500, editable: false }
       ],
        jsonReader: {
            root: "rows", //array containing actual data
            page: "page", //current page
            total: "total", //total pages for the query
            records: "records", //total number of records
            repeatitems: false,
            id: "id" //index of the column with the PK in it
        },
        rowNum: 20,
        rowList: [20, 30],
        pager: jQuery('#gridpager'),
        sortname: 'Name',
        viewrecords: true,
        sortorder: "asc",
        width:968,
        height:349
    }).navGrid('#gridpager');
});
</script>

Code works.I cant get data from server with using json. But I want to get colNames Dynamicly, too. I cant find any documentation about this topic. How can I get colNames and colModels dynamicly?

something like this:

colNames: data.colNames,
colModel: data.colModels,

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-06-14T11:10:23+00:00Added an answer on June 14, 2026 at 11:10 am

    You can do this but you it may not be worth it. The data you put into colModels will also have to hold all the presentation logic of these columns, such as size, editable, etc.

    If you think you can consistently figure all these options from your properties then it might work but it is hard to get a good looking grid that fits all kinds of data without customising the look a little. You would return your poco serialised as json that fits jqgrid schema.

    My personal opinion is to leave as is or look at buying another grid, say from telerik or rad controls. Indeed consider whether you want a grid at all.

    Two articles that might help you create the grids dynamically using asp.net-mvc

    http://www.codeproject.com/Articles/421189/jqGrid-MVC-Html-Helper

    http://www.codeproject.com/Articles/424640/ASP-NET-MVC-HTML-Helper-for-the-jqGrid

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

Sidebar

Related Questions

The problem about new Image() The following code is from 'JavaScript by Example Second
I use opengl es to display bgr24 data on iPad, I am new about
The team talks about one new effect released in jQUery UI 1.8. Which one
I have the following code in my controller: @nav_items = ActiveSupport::OrderedHash.new @nav_items[:home] = Struct::NavItem.new(Home,
I just want to learn something new here about my code. I have the
I have a code for jqGrid with custom editFunc that opens my own jQuery-UI
I m new about this topic (code first development). I want to do relationship
When I create a form to send data about new message: <% using (Html.BeginForm())
How can I create opends directory new attribute to insert new data about employee?
Is there something new about row-level security in SQL Server 2012? In 2008 and

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.