Search code examples
jqueryjqgridfree-jqgridtreegrid

Treegrid mode not working with free-jqgrid 4.9.0


I have the following treegrid working perfectly with jqGrid v4.5.2:

${"#tree").jqGrid({
  url: "/tree",
  datatype : "json",
  colModel : [{
    name: "data.id",
    key: true
  }, {
    name: "data.name"
  }],
  colNames : [],
  jsonReader : {
    page : 1,
    records : "total",
    repeatitems : false,
    root : "nodes",
    total : 1
  },
  treeGrid : true,
  treeGridModel : "adjacency",
  tree_root_level : 1,
  ExpandColumn : "data.id",
  ExpandColClick : true,
  treeReader : {
    leaf_field : "leaf",
    parent_id_field : "data.parentId"
});

The first data payload from the server is:

{
  "pageIndex": 1,
  "pageSize": 100
  "pages": 290,
  "total": 2891,
  "nodes": [
    {
      "data": { "id": 1, "name": "Node 1", "leaf": false },
      "errors": []
    },
    {
      "data": { "id": 2, "name": "Node 2", "leaf": false },
      "errors": []
    }
  ]
}

However, this same code does not work with free-jqgrid v4.9.0. Nothing happens when a node is expanded - no JavaScript error is seen in the browser console, no request is sent to the server, no other action takes place.


Solution

  • Upgrading to the latest version of free-jqgrid, v4.13.4 solved the problem. The treegrid started working without any errors.