jqgrid ASP.NET MVC -- getting data right for the grid.

Posted by SamM09 on Stack Overflow See other posts from Stack Overflow or by SamM09
Published on 2009-05-26T03:48:24Z Indexed on 2010/05/07 10:58 UTC
Read the original article Hit count: 458

Filed under:
|
|
|

Here is my dilemma,

I have not been able to manipulate my data to a form fitting to jqgrid standards. This is my first time using the jqgrid and I've spent a lot of time reading up on it.

My js code is as follows:

jQuery("#list").jqGrid({
            url: '/Home/ListContacts/',
                dataType: "json",
                contentType: "application/json; charset=utf-8",
                mtype: 'POST',
                colNames: ['First Name', 'MI', 'Last Name'],
                colModel: [
                  { name: 'First Name', index: 'FName', width: 40, align: 'left' },
                  { name: 'MI', index: 'MInitial', width: 40, align: 'left' },
                  { name: 'Last Name', index: 'LName', width: 400, align: 'left'}],
                        pager: jQuery('#pager'),
                        rowNum: 10,
                        rowList: [5, 10, 20, 50],
                        sortname: 'Id',
                        sortorder: "desc",
                        repeatitems: false,
                        viewrecords: true,
                        imgpath: '/scripts/themes/basic/images',
                        caption: 'My first grid'
                    }); 

        });

what im getting from the database: [["4","Jenna","Mccarthy"],["56","wer","weoiru"]]

Now correct me if I am wrong, but the index: in my colModel refers to the column names in my database right?

Could someone point to a reference that is straight forward or just start me off with this I would be most grateful.

© Stack Overflow or respective owner

Related posts about jqgrid

Related posts about AJAX