jqdatatreegrid.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * 返回json格式中 最好默认带有ID列
  3. 默认显示 20列
  4. * 列表id = 'gridTable'
  5. 列表url = 'Handler.ashx?action=page'
  6. 列表datatype = 'json'
  7. 列表colNames = ['ID', '名称', '性别', '手机', '邮箱']
  8. 列表colModel = 。。。
  9. 列表标题 caption = '用户列表'
  10. 列表修改URL editurl = 'Handler.ashx?action=oper'
  11. 列表默认排序 sortname = 'ID';
  12. 页码ID gridPagerID = 'gridPager'
  13. */
  14. //最后选中的行
  15. var lastsel;
  16. function myJqTreeGrid(id, url, datatype, colNames, colModel, caption,
  17. name, gridPagerID,sortorder,height,width,
  18. multiselect,rownumbers) {
  19. var myGrid = $('#' + id);
  20. myGrid.jqGrid({
  21. treeGrid: true,
  22. treeGridModel: 'adjacency', //treeGrid模式,跟json元数据有关 nested adjacency ,
  23. ExpandColumn :name,
  24. url: url,
  25. loadtext:"读取数据中。。。",
  26. datastr: 'data.json',
  27. datatype: datatype,
  28. height:height,
  29. width:width,
  30. rowNum: -1,
  31. rowList: [10, 20, 50],
  32. colNames: colNames,
  33. colModel: colModel,
  34. treeReader : {
  35. loaded: "loaded",
  36. level_field: "levels",
  37. parent_id_field: "parent",
  38. leaf_field: "isleaf",
  39. expanded_field: "expanded"
  40. },
  41. mtype: "POST"
  42. });
  43. }