<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
	<title>jQuery Grid Plugin - jqGrid - Topic: jquery jQGrid data not loading</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/jquery-jqgrid-data-not-loading</link>
	<description><![CDATA[Grid plugin]]></description>
	<generator>Simple:Press Version 5.7.5.3</generator>
	<atom:link href="http://www.trirand.com/blog/?page_id=393/help/jquery-jqgrid-data-not-loading/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>NBS on jquery jQGrid data not loading</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/jquery-jqgrid-data-not-loading#p27968</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/jquery-jqgrid-data-not-loading#p27968</guid>
        	        	<description><![CDATA[<p>I have tried with various blogs for jqGrid implementation but so far not able to load a grid with Json data from my wcf.</p>
<p>Here goes my html &#38; js code -</p>
<pre class="default prettyprint prettyprinted"><p><input type='button' class='sfcodeselect' name='sfselectit4357' value='Select Code' data-codeid='sfcode4357' /></p><div class='sfcode' id='sfcode4357'>!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&#62;
&#60;html xmlns="http://www.w3.org/1999/xhtml"&#62;
&#60;head&#62;
    &#60;title&#62;GSEA Administration&#60;/title&#62;
    &#60;script src="Scripts/jquery.js" type="text/javascript"&#62;&#60;/script&#62;
   &#60;script src="Scripts/grid.locale-en.js" type="text/javascript"&#62;&#60;/script&#62; 
    &#60;script src="Scripts/grid.base.js" type="text/javascript"&#62;&#60;/script&#62;
&#60;link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/&#62; 
&#60;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.14/jquery-ui.min.js"&#62;&#60;/script&#62;
    &#60;link href="css/ui.jqgrid.css" rel="stylesheet" type="text/css" /&#62;
&#60;script src="Scripts/jquery-1.7.2.min.js" type="text/javascript"&#62;&#60;/script&#62; 
&#60;script src="Scripts/jquery-1.8.0.min.js" type="text/javascript"&#62;&#60;/script&#62; 
&#60;script src="Scripts/jquery.jqGrid.min.js" type="text/javascript"&#62;&#60;/script&#62;

&#60;/head&#62;
&#60;body&#62;
&#60;form id="form1"&#62;
&#60;table id="list2" style="display: none"&#62;&#60;/table&#62;
&#60;div id="pager2"&#62;&#60;/div&#62;

&#60;script type="text/javascript"&#62;
    $(document).ready(function () {

        $("#list2").jqGrid({
            url: &#39;/Services/EOService.svc/GetGSEAAdministration&#39;,
            datatype: "json",
            mtype: &#39;GET&#39;,
            colNames: [&#39;Sr.No&#39;, &#39;Action Required&#39;, &#39;Chapter&#39;, &#39;Company&#39;, &#39;Country&#39;, &#39;Education&#39;, &#39;Email&#39;, &#39;Name&#39;, &#39;Sales&#39;, &#39;State&#39;, &#39;Status&#39;, &#39;WorkPhone&#39;, &#39;Date&#39;],
            colModel: [
            { name: &#39;ID&#39;, index: &#39;ID&#39;, width: 30, hidden: true },
            { name: &#39;ActionRequired&#39;, index: &#39;ActionRequired&#39;, width: 100, IsLink: true, DataFormat: "UpdateStatus.html?ID={0}&#38;Name={1}", DataFormatParamColumnName: "ID,Name" },
        { name: &#39;Chapter&#39;, index: &#39;Chapter&#39;, width: 80, align: "right" },
        { name: &#39;Company&#39;, index: &#39;Company&#39;, width: 80, align: "right" },
        { name: &#39;Country&#39;, index: &#39;Country&#39;, width: 80, align: "right" },
        { name: &#39;Education&#39;, index: &#39;Education&#39;, width: 80, align: "right" },
        { name: &#39;Email&#39;, index: &#39;Email&#39;, width: 80, align: "right" },
        { name: &#39;Name&#39;, index: &#39;Name&#39;, width: 55, IsLink: true, DataFormat: "GSEAProfile.html?ID={0}", DataFormatParamColumnName: "ID" },
        { name: &#39;Sales&#39;, index: &#39;Sales&#39;, width: 80, align: "right" },
        { name: &#39;State&#39;, index: &#39;State&#39;, width: 80, align: "right" },
        { name: &#39;Status&#39;, index: &#39;Status&#39;, width: 90 },
        { name: &#39;WorkPhone&#39;, index: &#39;WorkPhone&#39;, width: 150 },
        { name: &#39;Date&#39;, index: &#39;Date&#39;, width: 80, align: "right" }

    ],
            rowNum: 10,
            rowList: [10, 20, 30],
            pager: &#39;#pager2&#39;,
                //sortname: &#39;id&#39;,
            viewrecords: true,
          loadui:&#39;enable&#39; ,
//            loadonce: true,
            caption: "JSON Example",
            jsonReader: {
            root: &#39;rows&#39;,
            page: &#39;page&#39;,
            total: &#39;total&#39;,
            records: &#39;records&#39;,
            repeatitems: false,
            cell: &#39;cell&#39;,
            id: &#39;ID&#39;
//            userdata: &#39;userdata&#39;
            }
              //sortorder: "desc",

        });

$("#list2").jqGrid(&#39;navGrid&#39;,&#39;#pager2&#39;,{edit:false,add:false,del:false});
 });

    &#60;/script&#62;
    &#60;/form&#62;
&#60;/body&#62;
&#60;/html&#62;</div></pre>
<pre class="default prettyprint prettyprinted"><p><input type='button' class='sfcodeselect' name='sfselectit2710' value='Select Code' data-codeid='sfcode2710' /></p><div class='sfcode' id='sfcode2710'>Next is my WCF Code -</div></pre>
<pre class="default prettyprint prettyprinted"><p><input type='button' class='sfcodeselect' name='sfselectit8106' value='Select Code' data-codeid='sfcode8106' /></p><div class='sfcode' id='sfcode8106'><pre class="default prettyprint prettyprinted"><p><input type='button' class='sfcodeselect' name='sfselectit1323' value='Select Code' data-codeid='sfcode1323' /></p><div class='sfcode' id='sfcode1323'>ublic GSEAAdministration GetGSEAAdministration()
        {
            GSEAAdministration gr = new GSEAAdministration();
            gr.page = 1;
            gr.total = 2;
            gr.records = 10;
            gr.rows = GetGSEA().ToArray();
            return gr;
        }</div></pre>
<pre class="default prettyprint prettyprinted"><p><input type='button' class='sfcodeselect' name='sfselectit8203' value='Select Code' data-codeid='sfcode8203' /></p><div class='sfcode' id='sfcode8203'>My DataContracts are -</div></pre>
<pre class="default prettyprint prettyprinted"><p><input type='button' class='sfcodeselect' name='sfselectit8117' value='Select Code' data-codeid='sfcode8117' /></p><div class='sfcode' id='sfcode8117'><pre class="default prettyprint prettyprinted"><p><input type='button' class='sfcodeselect' name='sfselectit4539' value='Select Code' data-codeid='sfcode4539' /></p><div class='sfcode' id='sfcode4539'>DataContract]
    public class GSEAAdministration
    {
         private GSEATop[] _rows;
        private int _page;
        private int _total;
        private int _records;
        [DataMember]
        public int page { get { return _page; } set { _page = value; } }
        [DataMember]
        public GSEATop[] rows { get { return _rows; } set { _rows = value; } }
        [DataMember]
        public int total { get { return _total; } set { _total = value; } }
        [DataMember]
        public int records { get { return _records; } set { _records = value; } }
        public GSEAAdministration()
        {

        }
    }
    [DataContract]
     public class GSEATop
     {
         [DataMember]
        public GSEA cell { get; set; }
          [DataMember]
        public int id { get; set; }

     }
    [DataContract]
public class GSEA
     {
        [DataMember]
        public int ID { get; set; }
        [DataMember]
        public string Name { get; set; }
        [DataMember]
        public string Status { get; set; }
        [DataMember]
        public string ActionRequired { get; set; }
        [DataMember]
        public string Chapter { get; set; }
        [DataMember]
        public string Company { get; set; }
        [DataMember]
        public string Sales { get; set; }
        [DataMember]
        public string Date { get; set; }
        [DataMember]
        public string WorkPhone { get; set; }
        [DataMember]
        public string Email { get; set; }
        [DataMember]
        public string State { get; set; }
        [DataMember]
        public string Country { get; set; }
        [DataMember]
        public string Education { get; set; }
     }</div></pre>
<pre class="default prettyprint prettyprinted"><p><input type='button' class='sfcodeselect' name='sfselectit8036' value='Select Code' data-codeid='sfcode8036' /></p><div class='sfcode' id='sfcode8036'>//This is my test data</div></pre>
<pre class="default prettyprint prettyprinted"><p><input type='button' class='sfcodeselect' name='sfselectit2710' value='Select Code' data-codeid='sfcode2710' /></p><div class='sfcode' id='sfcode2710'><pre class="default prettyprint prettyprinted"><p><input type='button' class='sfcodeselect' name='sfselectit3231' value='Select Code' data-codeid='sfcode3231' /></p><div class='sfcode' id='sfcode3231'>public List&#60;GSEATop&#62; GetGSEA()
    {
        List&#60;GSEATop&#62; list = new List&#60;GSEATop&#62;();
        list.Add(new GSEATop() { cell = new GSEA() { ID = 1, ActionRequired = "Application received", Chapter = "", Company = "dg", Country = "BE", Education = "High School", Email = "adg", Name = "bd b", Sales = "0", State = "AL", Status = "Applicant", WorkPhone = "dag", Date = "11-Dec-12" }, id = 1 });
        list.Add(new GSEATop() { cell = new GSEA() { ID = 2, ActionRequired = "Application received", Chapter = "", Company = "dg", Country = "BE", Education = "High School", Email = "adg", Name = "bd b", Sales = "0", State = "AL", Status = "Applicant", WorkPhone = "dag", Date = "11-Dec-12" }, id = 2 });
        list.Add(new GSEATop() { cell = new GSEA() { ID = 3, ActionRequired = "Application received", Chapter = "", Company = "dg", Country = "BE", Education = "High School", Email = "adg", Name = "bd b", Sales = "0", State = "AL", Status = "Applicant", WorkPhone = "dag", Date = "11-Dec-12" }, id = 3 });
        list.Add(new GSEATop() { cell = new GSEA() { ID = 4, ActionRequired = "Application received", Chapter = "", Company = "dg", Country = "BE", Education = "High School", Email = "adg", Name = "bd b", Sales = "0", State = "AL", Status = "Applicant", WorkPhone = "dag", Date = "11-Dec-12" }, id = 4 });
        list.Add(new GSEATop() { cell = new GSEA() { ID = 5, ActionRequired = "Application received", Chapter = "", Company = "dg", Country = "BE", Education = "High School", Email = "adg", Name = "bd b", Sales = "0", State = "AL", Status = "Applicant", WorkPhone = "dag", Date = "11-Dec-12" }, id = 5 });
        list.Add(new GSEATop() { cell = new GSEA() { ID = 6, ActionRequired = "Application received", Chapter = "", Company = "dg", Country = "BE", Education = "High School", Email = "adg", Name = "bd b", Sales = "0", State = "AL", Status = "Applicant", WorkPhone = "dag", Date = "11-Dec-12" }, id = 6 });
        list.Add(new GSEATop() { cell = new GSEA() { ID = 7, ActionRequired = "Application received", Chapter = "", Company = "dg", Country = "BE", Education = "High School", Email = "adg", Name = "bd b", Sales = "0", State = "AL", Status = "Applicant", WorkPhone = "dag", Date = "11-Dec-12" }, id = 7 });
        list.Add(new GSEATop() { cell = new GSEA() { ID = 8, ActionRequired = "Application received", Chapter = "", Company = "dg", Country = "BE", Education = "High School", Email = "adg", Name = "bd b", Sales = "0", State = "AL", Status = "Applicant", WorkPhone = "dag", Date = "11-Dec-12" }, id = 8 });
        list.Add(new GSEATop() { cell = new GSEA() { ID = 9, ActionRequired = "Application received", Chapter = "", Company = "dg", Country = "BE", Education = "High School", Email = "adg", Name = "bd b", Sales = "0", State = "AL", Status = "Applicant", WorkPhone = "dag", Date = "11-Dec-12" }, id = 9 });
        list.Add(new GSEATop() { cell = new GSEA() { ID = 10, ActionRequired = "Application received", Chapter = "", Company = "dg", Country = "BE", Education = "High School", Email = "adg", Name = "bd b", Sales = "0", State = "AL", Status = "Applicant", WorkPhone = "dag", Date = "11-Dec-12" }, id = 10 });
        return list;
    }</div></pre>
<pre class="default prettyprint prettyprinted"><p><input type='button' class='sfcodeselect' name='sfselectit6138' value='Select Code' data-codeid='sfcode6138' /></p><div class='sfcode' id='sfcode6138'>After all this my JSON output looks like this in fiddler (for json formatting i checked it via&#160;<a rel="nofollow" href="http://jsonlint.com/" target="_blank">jsonlint</a>-output wasValid Json) -</div></pre>
<pre class="default prettyprint prettyprinted"><p><input type='button' class='sfcodeselect' name='sfselectit106' value='Select Code' data-codeid='sfcode106' /></p><div class='sfcode' id='sfcode106'><pre class="default prettyprint prettyprinted"><p><input type='button' class='sfcodeselect' name='sfselectit7598' value='Select Code' data-codeid='sfcode7598' /></p><div class='sfcode' id='sfcode7598'>{"page":1,"records":10,"rows":[{"cell":{"ActionRequired":"Application received","Chapter":"","Company":"dg","Country":"BE","Date":"11-Dec-12","Education":"High School","Email":"adg","ID":1,"Name":"bd b","Sales":"0","State":"AL","Status":"Applicant","WorkPhone":"dag"},"id":1},{"cell":{"ActionRequired":"Application received","Chapter":"","Company":"dg","Country":"BE","Date":"11-Dec-12","Education":"High School","Email":"adg","ID":2,"Name":"bd b","Sales":"0","State":"AL","Status":"Applicant","WorkPhone":"dag"},"id":2},{"cell":{"ActionRequired":"Application received","Chapter":"","Company":"dg","Country":"BE","Date":"11-Dec-12","Education":"High School","Email":"adg","ID":3,"Name":"bd b","Sales":"0","State":"AL","Status":"Applicant","WorkPhone":"dag"},"id":3},{"cell":{"ActionRequired":"Application received","Chapter":"","Company":"dg","Country":"BE","Date":"11-Dec-12","Education":"High School","Email":"adg","ID":4,"Name":"bd b","Sales":"0","State":"AL","Status":"Applicant","WorkPhone":"dag"},"id":4},{"cell":{"ActionRequired":"Application received","Chapter":"","Company":"dg","Country":"BE","Date":"11-Dec-12","Education":"High School","Email":"adg","ID":5,"Name":"bd b","Sales":"0","State":"AL","Status":"Applicant","WorkPhone":"dag"},"id":5},{"cell":{"ActionRequired":"Application received","Chapter":"","Company":"dg","Country":"BE","Date":"11-Dec-12","Education":"High School","Email":"adg","ID":6,"Name":"bd b","Sales":"0","State":"AL","Status":"Applicant","WorkPhone":"dag"},"id":6},{"cell":{"ActionRequired":"Application received","Chapter":"","Company":"dg","Country":"BE","Date":"11-Dec-12","Education":"High School","Email":"adg","ID":7,"Name":"bd b","Sales":"0","State":"AL","Status":"Applicant","WorkPhone":"dag"},"id":7},{"cell":{"ActionRequired":"Application received","Chapter":"","Company":"dg","Country":"BE","Date":"11-Dec-12","Education":"High School","Email":"adg","ID":8,"Name":"bd b","Sales":"0","State":"AL","Status":"Applicant","WorkPhone":"dag"},"id":8},{"cell":{"ActionRequired":"Application received","Chapter":"","Company":"dg","Country":"BE","Date":"11-Dec-12","Education":"High School","Email":"adg","ID":9,"Name":"bd b","Sales":"0","State":"AL","Status":"Applicant","WorkPhone":"dag"},"id":9},{"cell":{"ActionRequired":"Application received","Chapter":"","Company":"dg","Country":"BE","Date":"11-Dec-12","Education":"High School","Email":"adg","ID":10,"Name":"bd b","Sales":"0","State":"AL","Status":"Applicant","WorkPhone":"dag"},"id":10}],"total":2}</div></pre>
<div>
<p><input type='button' class='sfcodeselect' name='sfselectit1399' value='Select Code' data-codeid='sfcode1399' /></p>
<div class='sfcode' id='sfcode1399'>
<p>[Image Can Not Be Found]</p>
<p>After all this, my jqgrid is displaying no data,although columns are being created but with "undefined" footer.</p>
<p>Seeking all the help that I can get from here.</p>
</div>
</div>
</div>
</div>
</div>
</div>
]]></description>
        	        	<pubDate>Sat, 29 Dec 2012 10:30:06 +0200</pubDate>
        </item>
</channel>
</rss>