Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.32 KB | None | 0 0
  1. .on("click", function(){
  2. var myId = $(this).attr("id");
  3. $("#studentGrid").jqGrid.setSelection(myId, true);
  4. });
  5.  
  6. $("#studentGrid").jqGrid({
  7. url: '<c:url value="/students/studentjsondata"/>',
  8. datatype: 'json',
  9. height: 'auto',
  10. colNames:['id','First Name', 'Last Name', 'Other Name' ,'Date Of Birth', 'Gender'],
  11. colModel:[
  12. //Bla Bla Bla
  13. ],
  14. rowNum:10,
  15. autowidth: true,
  16. pager: '#pager',
  17. sortname: 'id',
  18. viewrecords: true,
  19. sortorder: "desc",
  20. caption:"Students",
  21. emptyrecords: "Empty Records",
  22. subGrid: true,
  23. /* <![CDATA[ */
  24. onSelectRow: function(id){
  25. if((lastsel != 0)&&(id!==lastsel)){
  26. $("#studentGrid").jqGrid('collapseSubGridRow', lastsel);
  27. }
  28. lastsel=id;
  29. }/* ]]> */ ,
  30. subGridOptions: {
  31. "plusicon" : "ui-icon-triangle-1-e",
  32. "minusicon" : "ui-icon-triangle-1-s",
  33. "openicon" : "ui-icon-arrowreturn-1-e",
  34. "reloadOnExpand" : true,
  35. "selectOnExpand" : true
  36. },
  37. subGridRowExpanded: function(subgrid_id, row_id) {
  38. //Bla Bla Bla
  39. }
  40. });
  41.  
  42. {'page':'1', 'records':'1', 'total':'1', 'rows':[{'id':'7385', 'cell': ['Max', 'Payne', '', 'September 16, 2012', 'Male']}]}
  43.  
  44.  
  45. .on("click", function(){
  46. var myNewData = eval('(' + $(this).attr("griddata") + ')');
  47. $("#studentGrid").jqGrid('setGridParam', { datatype: 'local', data: myNewData}).trigger('reloadGrid');
  48. });
  49.  
  50. .on("click", function(){
  51. $("#studentGrid").jqGrid('setGridParam', { jsonReader: { repeatitems: false }, datatype: 'jsonstring', datastr: $(this).attr("griddata")}).trigger('reloadGrid');
  52. });
  53.  
  54. $("#studentGrid").jqGrid('setGridParam', { jsonReader : {
  55. root: "rows",
  56. page: "page",
  57. total: "total",
  58. records: "records",
  59. repeatitems: true,
  60. cell: "cell",
  61. id: "id",
  62. userdata: "userdata",
  63. subgrid: {root:"rows",
  64. repeatitems: true,
  65. cell:"cell"
  66. }
  67. } , datatype: 'json', datastr: null});
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement