forum.venkateswarlu.net
      Register      Login
JQGrid with Dynamic Columns

1 replies to this topic

MalliKarjuna Cherukuri #1
Member
52 Points
Posted on 16 Jun 2015 12:54 PM IST Hi, I am using jqgrid to display a report. SQL procedure returns Pivoted columns along with static columns. Now how to use jqgrid with dynamic columns? Is it possible or not?

Thanks,
Malli
 
ASP.NET,C#.NET,Dot Net,JQuery     933 views     Reply to this topic
Jahnavi N #2
Member
164 Points
Replied on 16 Jun 2015 07:53 PM IST
$.ajax(
    {
       type: "POST",
       url: "SomeUrl/GetColumnsAndData",
       data: "",
       dataType: "json",
       success: function(result)
       {
            colD = result.colData;
            colN = result.colNames;
            colM = result.colModel;
            jQuery("#list").jqGrid({
                jsonReader : {
                    cell: "",
                    id: "0"
                },
                url: 'SomeUrl/Getdata',
                datatype: 'jsonstring',
                mtype: 'POST',
                datastr : colD,
                colNames:colN,
                colModel :colM,
                pager: jQuery('#pager'),
                rowNum: 5,
                rowList: [5, 10, 20, 50],
                viewrecords: true
            })
       },
       error: function(x, e)
       {
            alert(x.readyState + " "+ x.status +" "+ e.msg);   
       }
    });
setTimeout(function() {$("#list").jqGrid('setGridParam',{datatype:'json'}); },50);
 
Reply to this topic