Search code examples
javascriptjqgridtreegrid

jqgrid treegrid how to reload data?


I know how to reload normal jqgrid table. I used the same method to reload treegrid, but it doesn't work.

The usual method to reload jqgrid:

$jqGrid.jqGrid('setGridParam',{ 
        url:path+"/admin/demo/getLogsGridJson.do", 
        postData:{'aaa':111,'bbb':222}, //
        page:1 
}).trigger("reloadGrid");  

This way I can again request and refresh data. But with treegrid it doesn't work.

How to reload treegrid to use new postData or new url?


Solution

  • To reload the jqGrid TreeGrid with new post data you will need to set treedattype to json like this

    $jqGrid.jqGrid('setGridParam',{ 
        url:path+"/admin/demo/getLogsGridJson.do", 
        postData:{'aaa':111,'bbb':222}, //
        page:1,
        treedatatype : 'json'
    }).trigger("reloadGrid");
    

    More about why is this you can read in Guriddo jqGrid Documenatation here Kind Regards