easy ui datagrid



  1. $(function(){
  2. $('#dataGrid').datagrid({
  3. nowrap: true,
  4. autoRowHeight: false,
  5. height:400,
  6. striped: true,
  7. collapsible:true,
  8. loadMsg:"数据加载中...",
  9. url:'${baseURL}/stuinfomge/stuinfomgeAction!ajaxSearch.action',
  10. loadFilter:function(data){
  11. try {
  12. tempData = data.data.resultMap;
  13. } catch (e) {
  14. tempData=data;
  15. }
  16. return tempData;
  17. },
  18. remoteSort:false,
  19. frozenColumns:[[
  20. {field:'ID',checkbox:true}
  21. ]],
  22. columns:[[
  23. {field:'STU_NAME',title:'学生姓名',width:120,sortable:true},
  24. {field:'ORGANIZATION_NAME',title:'所属班级',width:120,sortable:true},
  25. {field:'PARENT_NAME',title:'家长姓名',width:120,sortable:true},
  26. {field:'CONCAT_PHONE',title:'联系电话',width:120,sortable:true},
  27. {field:'CARD_NUM',title:'门禁卡号',width:120,sortable:true},
  28. {field:'CONCAT_ADDRESS',title:'联系地址',width:240,sortable:true},
  29. {field:'opt',title:'操作',width:200,align:'center',
  30. formatter:function(value,rec){
  31. var rethtml='';
  32. rethtml += "<span style=\"color:#08f;cursor:pointer;\" onclick=\"view('"+ rec.ID + "')\">查看</span>|";
  33. rethtml += "<span style=\"color:#08f;cursor:pointer;\" onclick=\"editStuinfo('"+ rec.ID + "')\">修改</span>|";
  34. rethtml += "<span style=\"color:#08f;cursor:pointer;\" onclick=\"rme('"+ rec.ID + "')\">删除</span>|";
  35. return rethtml;
  36. }
  37. }
  38. ]],
  39. pagination:true,
  40. rownumbers:true,
  41. toolbar:[{
  42. id:'btnadd',
  43. text:'新增',
  44. iconCls:'icon-add',
  45. handler:function(){
  46. shoPanelWindow('addStuinfoDiv',900,550,'icon-add','新增学生信息');
  47. }
  48. },'-',{
  49. id:'btnclear',
  50. text:'删除',
  51. iconCls:'icon-clear',
  52. handler:function(){
  53. var rows = getSelections();
  54. rme(rows)
  55. }
  56. },'-',{
  57. id:'btnimport',
  58. text:'批量导入',
  59. iconCls:'icon-import',
  60. handler:function(){
  61. }
  62. }]
  63. });
  64. var p = $('#dataGrid').datagrid('getPager');
  65. $(p).pagination({displayMsg:"",beforePageText:"当前页",afterPageText:"总页数:{pages}",
  66. onBeforeRefresh:function(){
  67. $('#dataGrid').datagrid("reload");
  68. }
  69. });
  70. });
  71. function getSelections(){
  72. var ids = [];
  73. var rows = $('#dataGrid').datagrid('getSelections');
  74. for(var i=0;i<rows.length;i++){
  75. ids.push("'" + rows[i].ID + "'");
  76. }
  77. return ids.join(',');
  78. }
  79. function doSearch(){
  80. $('#dataGrid').datagrid('loadData', { total: 0, rows: [] });
  81. $('#dataGrid').datagrid('load',{
  82. 'searchValue.stuname': ($("#stuname").val()),
  83. 'searchValue.orgid': ($("#searchorgid").val())
  84. });
  85. }

posted on 2017-03-22 09:28  signheart  阅读(247)  评论(0编辑  收藏  举报

导航