title: JQgrid - treegrid error
body: <p>I have looked at the related question
  <a href="https://stackoverflow.com/questions/5322608/jqgrid-tree-view-adjacencey/5333199#5333199">This question</a></p>
  
  <p>and have tried to apply to my tasks.
  I get headers of the grid with some hanging bubble over it that says "Loading..." and nothing happens.  When I run console, in there I see an error that says this:</p>
  
  <pre><code> SCRIPT5007: Unable to get value of the property 'stype': object is null or undefined 
   jquery.jqGrid.min.js, line 72 character 461    
  </code></pre>
  
  <p>Like this: <img src="https://i.stack.imgur.com/r4tJV.jpg" alt="Screen shot"></p>
  
  <p>1) The solution presented by Oleg works great out of the box.  That is with his json and his javascript.  Thanks.<br>
  2) I have a Json data that looks similar to the one used by Oleg.  Here it is</p>
  
  <pre><code>{
   "results":[
    {
       "analysisStatus":null,
       "label":"SPR - Test Only - Cost Analyzer 1-GUI Prototype",
       "leaf":false,
       "level":0,
       "lockedBy":"",
       "overrideCostingMRC":955.2800,
       "overrideCostingNRC":3739.7900,
       "overrideCostingUsage":151.7300,
       "overridePricingMRC":1531.4800,
       "overridePricingNRC":2580.0000,
       "overridePricingUsage":210.4800,
       "parent":"",
       "proposedCostingMRC":955.2800,
       "proposedCostingNRC":3739.7900,
       "proposedCostingUsage":151.7300,
       "proposedPricingMRC":1531.4800,
       "proposedPricingNRC":2580.0000,
       "proposedPricingUsage":210.4800,
       "rowId":36624,
       "standardCostingMRC":955.2800,
       "standardCostingNRC":3739.7900,
       "standardCostingUsage":151.7300,
       "standardPricingMRC":1531.4800,
       "standardPricingNRC":2580.0000,
       "standardPricingUsage":210.4800
    },
    {
       "label":"Broadspeed DIA 3.0: 1.5 Mb\/s",
       "leaf":false,
       "level":1,
       "overrideCostingMRC":299.9400,
       "overrideCostingNRC":118.4400,
       "overrideCostingUsage":0.0000,
       "overridePricingMRC":444.0000,
       "overridePricingNRC":800.0000,
       "overridePricingUsage":0.0000,
       "parent":36624,
       "proposedCostingMRC":299.9400,
       "proposedCostingNRC":118.4400,
       "proposedCostingUsage":0.0000,
       "proposedPricingMRC":444.0000,
       "proposedPricingNRC":800.0000,
       "proposedPricingUsage":0.0000,
       "rowId":54130,
       "standardCostingMRC":299.9400,
       "standardCostingNRC":118.4400,
       "standardCostingUsage":0.0000,
       "standardPricingMRC":444.0000,
       "standardPricingNRC":800.0000,
       "standardPricingUsage":0.0000
     },
     {
       "label":"Broadview PRI: Measured GR",
       "leaf":false,
       "level":1,
       "overrideCostingMRC":298.1700,
       "overrideCostingNRC":208.0000,
       "overrideCostingUsage":115.7600,
       "overridePricingMRC":409.6800,
       "overridePricingNRC":800.0000,
       "overridePricingUsage":210.4800,
       "parent":36624,
       "proposedCostingMRC":298.1700,
       "proposedCostingNRC":208.0000,
       "proposedCostingUsage":115.7600,
       "proposedPricingMRC":409.6800,
       "proposedPricingNRC":800.0000,
       "proposedPricingUsage":210.4800,
       "rowId":54131,
       "standardCostingMRC":298.1700,
       "standardCostingNRC":208.0000,
       "standardCostingUsage":115.7600,
       "standardPricingMRC":409.6800,
       "standardPricingNRC":800.0000,
       "standardPricingUsage":210.4800
     },
     {
       "label":"Wild Card - Customer",
       "leaf":true,
       "level":2,
       "overrideCostingMRC":0.0000,
       "overrideCostingNRC":0.0000,
       "overrideCostingUsage":0.0000,
       "overridePricingMRC":234.0000,
       "overridePricingNRC":0.0000,
       "overridePricingUsage":0.0000,
       "parent":54130,
       "proposedCostingMRC":0.0000,
       "proposedCostingNRC":0.0000,
       "proposedCostingUsage":0.0000,
       "proposedPricingMRC":0.0000,
       "proposedPricingNRC":0.0000,
       "proposedPricingUsage":0.0000,
       "rowId":388316,
       "standardCostingMRC":0.0000,
       "standardCostingNRC":0.0000,
       "standardCostingUsage":0.0000,
       "standardPricingMRC":0.0000,
       "standardPricingNRC":0.0000,
       "standardPricingUsage":0.0000
    },
    {
       "label":"Wild Card - Customer",
       "leaf":true,
       "level":2,
       "overrideCostingMRC":0.0000,
       "overrideCostingNRC":0.0000,
       "overrideCostingUsage":0.0000,
       "overridePricingMRC":40.0000,
       "overridePricingNRC":0.0000,
       "overridePricingUsage":0.0000,
       "parent":54130,
       "proposedCostingMRC":0.0000,
       "proposedCostingNRC":0.0000,
       "proposedCostingUsage":0.0000,
       "proposedPricingMRC":0.0000,
       "proposedPricingNRC":0.0000,
       "proposedPricingUsage":0.0000,
       "rowId":404097,
       "standardCostingMRC":0.0000,
       "standardCostingNRC":0.0000,
       "standardCostingUsage":0.0000,
       "standardPricingMRC":0.0000,
       "standardPricingNRC":0.0000,
       "standardPricingUsage":0.0000
    },
    {
       "label":"Wild Card - Customer",
       "leaf":true,
       "level":2,
       "overrideCostingMRC":0.0000,
       "overrideCostingNRC":0.0000,
       "overrideCostingUsage":0.0000,
       "overridePricingMRC":0.0000,
       "overridePricingNRC":0.0000,
       "overridePricingUsage":0.0000,
       "parent":54131,
       "proposedCostingMRC":0.0000,
       "proposedCostingNRC":0.0000,
       "proposedCostingUsage":0.0000,
       "proposedPricingMRC":0.0000,
       "proposedPricingNRC":0.0000,
       "proposedPricingUsage":0.0000,
       "rowId":404098,
       "standardCostingMRC":0.0000,
       "standardCostingNRC":20.0000,
       "standardCostingUsage":0.0000,
       "standardPricingMRC":0.0000,
       "standardPricingNRC":0.0000,
       "standardPricingUsage":0.0000
    },
    {
       "label":"Wild Card - Customer",
       "leaf":true,
       "level":2,
       "overrideCostingMRC":0.0000,
       "overrideCostingNRC":0.0000,
       "overrideCostingUsage":0.0000,
       "overridePricingMRC":3.25,
       "overridePricingNRC":0.0000,
       "overridePricingUsage":0.0000,
       "parent":54131,
       "proposedCostingMRC":0.0000,
       "proposedCostingNRC":0.0000,
       "proposedCostingUsage":0.0000,
       "proposedPricingMRC":0.3000,
       "proposedPricingNRC":0.0000,
       "proposedPricingUsage":0.0000,
       "rowId":404099,
       "standardCostingMRC":0.0000,
       "standardCostingNRC":0.0000,
       "standardCostingUsage":0.0000,
       "standardPricingMRC":0.0000,
       "standardPricingNRC":0.0000,
       "standardPricingUsage":0.0000
    }
  </code></pre>
  
  <p>]
  }</p>
  
  <p>My javascript code with the defined grid looks like this:</p>
  
  <pre><code>    &lt;script type="text/javascript"&gt;
      $(document).ready(function (){
          $.getJSON('sources/cost-analyzer2.json', function(data){
              console.log(data.results);
              var this_grid;
              this_grid = $this_app.define_grid("#grid-results", {
                  caption: 'Proposals',
                  pager: '#pager-results',
                  data: $.extend(true, [], data.results),                 
                  datatype: "local",
                  height: 'auto',
  
                  rowNumbers: true,               
  colNames:['Id', 'Description','Price MRC', 'Cost MRC','Price NRC', 'Cost NRC',  
                      'Price Usage', 'Cost Usage',
  'Price MRC', 'Cost MRC','Price NRC', 'Cost NRC', 'Price Usage', 'Cost Usage',
  'Price MRC', 'Cost MRC','Price NRC', 'Cost NRC', 'Price Usage', 'Cost Usage'
  ],
  colModel: [                     
      { name: 'rowId', index: 'rowId',  width: 20, hidden:true},      
      { name: 'label', index: 'abel', width: 100},
      { name: 'standardPricingMRC', index: 'standardPricingMRC', width: 70},
      { name: 'standardCostingMRC', index: 'standardCostingMRC', width: 70},
      { name: 'standardPricingNRC', index: 'standardPricingNRC', width: 70},
      { name: 'standardCostingNRC', index: 'standardCostingNRC', width: 70},
      { name: 'standardPricingUsage', index: 'standardPricingMRC', width: 70},
      { name: 'standardCostingUsage', index: 'standardCostingMRC', width: 70},
      { name: 'proposedPricingMRC', index: 'proposedPricingMRC', width: 70},
      { name: 'proposedCostingMRC', index: 'proposedCostingMRC', width: 70},
      { name: 'proposedPricingNRC', index: 'proposedPricingNRC', width: 70},
      { name: 'proposedCostingNRC', index: 'proposedCostingNRC', width: 70},
      { name: 'proposedPricingUsage', index: 'proposedPricingMRC', width: 70},
      { name: 'proposedCostingUsage', index: 'proposedCostingMRC', width: 70},
      { name: 'overridePricingMRC', index: 'overridePricingMRC', width: 70},
      { name: 'overrideCostingMRC', index: 'overrideCostingMRC', width: 70},
      { name: 'overridePricingNRC', index: 'overridePricingNRC', width: 70},
      { name: 'overrideCostingNRC', index: 'overrideCostingNRC', width: 70},
      { name: 'overridePricingUsage', index: 'overridePricingMRC', width: 70},
      { name: 'overrideCostingUsage', index: 'overrideCostingMRC', width: 70} 
              ],
                  localReader: {
                      repeatitems: false,                     
                      root: "data.results"                    
                  },// end of localReader
                  treeGrid: true,
                  treeGridModel: 'adjacency',
                  treedatatype: "local",
                  ExpandColumn: 'label',
                  inline_editing: false
              });// end of define_grid --&gt;    
  
              $("#grid-results").jqGrid('gridResize');
              $("#grid-results").jqGrid('setGroupHeaders', {
      useColSpanStyle: false, 
      groupHeaders:[
  {startColumnName: 'standardPricingMRC', numberOfColumns: 6, titleText: 'Standard'},
  {startColumnName: 'proposedPricingMRC', numberOfColumns: 6, titleText: 'Proposed'},
  {startColumnName: 'overridePricingMRC', numberOfColumns: 6, titleText: 'Override'}
                    ] 
                  });
  
              $("#grid-results").jqGrid('setGroupHeaders', {
                    useColSpanStyle: true, 
                    groupHeaders:[
  {startColumnName: 'standardPricingMRC', numberOfColumns: 2, titleText: 'MRC'},
  {startColumnName: 'standardPricingNRC', numberOfColumns: 2, titleText: 'NRC'},
  {startColumnName: 'standardPricingUsage', numberOfColumns: 2, titleText: 'Usage'},
  {startColumnName: 'proposedPricingMRC', numberOfColumns: 2, titleText: 'MRC'},
  {startColumnName: 'proposedPricingNRC', numberOfColumns: 2, titleText: 'NRC'},
  {startColumnName: 'proposedPricingUsage', numberOfColumns: 2, titleText: 'Usage'},
  {startColumnName: 'overridePricingMRC', numberOfColumns: 2, titleText: 'MRC'},
  {startColumnName: 'overridePricingNRC', numberOfColumns: 2, titleText: 'NRC'},
  {startColumnName: 'overridePricingUsage', numberOfColumns: 2, titleText: 'Usage'}
                    ] 
                  });
  
  
          }); &lt;!-- end of getJSon() --&gt;
      });&lt;!-- end of ready() --&gt;    
  &lt;/script&gt;
  </code></pre>
  
  <p>If I remove the following lines, I will see my data in a grid fine, but with NO TREE.</p>
  
  <pre><code>    treeGrid: true,
  treeGridModel: 'adjacency',
  treedatatype: "local",
  ExpandColumn: 'label',
  </code></pre>
  
  <p>Can anyone help?  what am I doing wrong?</p>
  
  <p>Thanks              </p>