/www/js/magic_app.js

http://cupsfilter.googlecode.com/ · JavaScript · 88 lines · 80 code · 6 blank · 2 comment · 0 complexity · 6b8268ae426b75747c86bd8b6993d347 MD5 · raw file

  1. jQuery(document).ready(function(){
  2. var printersel='create_sel.php?field=printer';
  3. var markersel='create_sel.php?field=marker';
  4. var cups_sel='create_sel.php?field=cupsuser';
  5. var executorsel='create_sel.php?field=executor';
  6. var pressmansel='create_sel.php?field=pressman';
  7. jQuery("#tblcontents").jqGrid({
  8. url:'getdata.php',
  9. datatype: 'json',
  10. mtype: 'POST',
  11. height: 200,
  12. datatype: 'local',
  13. colNames:['#','????','???????','????','???????? ?????????','? ??','???. ?????','?????','? ?????','???-?? ???.','???-?? ?????','CupsUser','???????????','?????????','?????? ???-??','??????????'],
  14. colModel:[
  15. {name:'id',index:'id', search:false, editable:false, width:35},
  16. {name:'datetime',index:'datetime', formatter:'date',formatoptions:{srcformat: 'Y-m-d',newformat: 'd.m.Y'},width:80, align:'right'},
  17. {name:'printer_name',index:'printer_name',search:true,edittype:'select',surl:printersel, width:90},
  18. {name:'docmarker',index:'docmarker', edittype:'select',surl:markersel,width:90, align:'right'},
  19. {name:'docname',index:'docname', width:250,align:'center',sortable:false},
  20. {name:'mb_number',index:'mb_number', width:90, align:'right'},
  21. {name:'inv_number',index:'inv_number', width:90, align:'right'},
  22. {name:'punkt',index:'punkt', width:90, align:'right'},
  23. {name:'copynumber',index:'copynamber', width:80, align:'right'},
  24. {name:'pagecount',index:'pagecount', width:80, align:'right'},
  25. {name:'pagecopy',index:'pagecopy', width:80, align:'right'},
  26. {name:'cupsuser',index:'cupsuser',edittype:'select',surl:cups_sel, width:80, sortable:false},
  27. {name:'executor_fio',index:'executor_fio',edittype:'select',surl:executorsel,width:150, sortable:false},
  28. {name:'pressman_fio',index:'pressman_fio',edittype:'select',surl:pressmansel,width:150, sortable:false},
  29. {name:'status',index:'status', search:false,width:100, align:'right'},
  30. {name:'infostr',index:'infostr',search:false, width:180, sortable:false}
  31. ],
  32. rowNum:10,
  33. rowList:[10,20,30,50],
  34. pager: jQuery('#tblcontentsPager'),
  35. sortname: 'id',
  36. viewrecords: true,
  37. imgpath: 'themes/basic/images',
  38. caption: '????????? ?????? ??????? ?????????? ??????',
  39. sortorder: "asc",
  40. subGrid: true,
  41. subGridRowExpanded: function(subgrid_id, row_id) {
  42. // we pass two parameters, subgrid_id is a id of the div tag created within a table, the row_id is the id of the row
  43. // If we want to pass additional parameters to the url we can use the method getRowData(row_id) - which returns associative array in type name-value here we can easy construct the following
  44. var subgrid_table_id;
  45. subgrid_table_id = subgrid_id+"_t";
  46. jQuery("#"+subgrid_id).html("<table id='"+subgrid_table_id+"' class='scroll'></table>");
  47. jQuery("#"+subgrid_table_id).jqGrid({
  48. url:"subgrid.php?id="+row_id,
  49. datatype: "json",
  50. colNames: ['rep_id','list_id','??????????'],
  51. colModel: [
  52. {name:'rep_id',index:'rep_id',width:80,key:true},
  53. {name:'list_id',index:'list_id',width:80},
  54. {name:'adress',index:'adress',width:200,align:'right',sortable:false}
  55. ],
  56. rowNum:20,
  57. imgpath: 'themes/basic/images',
  58. sortname: 'rep_id',
  59. sortorder: "asc"
  60. });
  61. }
  62. })
  63. jQuery("#srccontents").filterGrid("tblcontents",{
  64. gridModel:true,
  65. gridNames:true,
  66. searchButton:"??????",
  67. clearButton:"????????",
  68. formtype:"vertical",
  69. enableSearch: true,
  70. enableClear: true,
  71. autosearch: false
  72. });
  73. jQuery("#tblcontents").setGridParam({datatype:'json'});
  74. var ts = $('#srccontents')[0];
  75. ts.triggerSearch();
  76. });
  77. $(function() {
  78. $('#sg_datetime').datepicker({
  79. changeMonth: true,
  80. changeYear: true
  81. });
  82. });