Advertisement
Guest User

Untitled

a guest
Jun 25th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.46 KB | None | 0 0
  1. var mydata = [
  2. {
  3. id: "1",
  4. invdate: "2010-05-24",
  5. name: "test",
  6. note: "note",
  7. tax: "10.00",
  8. total: "2111.00"},
  9. {
  10. id: "2",
  11. invdate: "2010-05-25",
  12. name: "test2",
  13. note: "note2",
  14. tax: "20.00",
  15. total: "320.00"},
  16. {
  17. id: "3",
  18. invdate: "2007-09-01",
  19. name: "test3",
  20. note: "note3",
  21. tax: "30.00",
  22. total: "430.00"},
  23. {
  24. id: "4",
  25. invdate: "2007-10-04",
  26. name: "test",
  27. note: "note",
  28. tax: "10.00",
  29. total: "210.00"},
  30. {
  31. id: "5",
  32. invdate: "2007-10-05",
  33. name: "test2",
  34. note: "note2",
  35. tax: "20.00",
  36. total: "320.00"}
  37. ];
  38.  
  39. jQuery("#list47").jqGrid({
  40. data: mydata,
  41. datatype: "local",
  42. height: 150,
  43. rowNum: 999999,
  44. scroll: true,
  45. colNames: ['Inv No', 'Date', 'Client', 'Amount', 'Tax', 'Total','Testing', 'Notes'],
  46. colModel: [
  47. {
  48. name: 'id',
  49. index: 'id',
  50. width: 60,
  51. sorttype: "int"},
  52. {
  53. name: 'invdate',
  54. index: 'invdate',
  55. width: 90,
  56. sorttype: "date",
  57. formatter: "date"},
  58. {
  59. name: 'name',
  60. index: 'name',
  61. width: 100},
  62. {
  63. name: 'amount',
  64. index: 'amount',
  65. width: 80,
  66. align: "right",
  67. sorttype: "float",
  68. formatter: "number"},
  69. {
  70. name: 'tax',
  71. index: 'tax',
  72. width: 80,
  73. align: "right",
  74. sorttype: "float"},
  75. {
  76. name: 'total',
  77. index: 'total',
  78. width: 80,
  79. align: "right",
  80. sorttype: "float"},
  81. { name: "Id_ListaMultiple", index:"Id_ListaMultiple",editable:true,edittype:"custom",editoptions:{custom_element:multiCheckElem, custom_value:multiCheckVal,list:let_val}},
  82. {
  83. name: 'note',
  84. index: 'note',
  85. width: 150,
  86. sortable: false}
  87. ],
  88. pager: "#plist47",
  89. //viewrecords: true,
  90. //multiselect: true,
  91. caption: "single selection",
  92. gridComplete: function() {
  93. $("#list47_cb").css("width","100px");
  94. $("#list47 tbody tr").children().first("td").css("width","100px");
  95. }
  96. });
  97. jQuery("#list47").jqGrid('navGrid','#plist47',{edit:true,add:true,del:true,search:true});
  98.  
  99. function multiCheckElem(values, optio) {
  100. var id = optio.id;
  101. alert(values);
  102. var ctl = '<div id="'+ id + '" class="checklist">';
  103. var ckboxAry = optio.list.split(';');
  104. var aValues = [];
  105. if (values && values.length)
  106. {
  107. aValues = values.split(",");
  108. }
  109. for (var i = 0; i < ckboxAry.length; i++)
  110. {
  111. var item = ckboxAry[i].split(':');
  112. ctl += '<input type="checkbox" ';
  113.  
  114. if (aValues.indexOf(item[0]) != -1)
  115. {
  116. if (items) items += ","
  117. items += e.value;
  118. });
  119. }
  120. else // launched
  121. {
  122. }
  123. return items;
  124. }
  125. function let_val(cellvalue, options, rowObject){
  126. return "2:Reposición;1:Solicitud Inicial;0:test";
  127. } ctl += 'value="' + item[0] + '"> ' + item[1] + '</input><br/>';
  128. }
  129. return ctl + '</div>';
  130. }
  131.  
  132. function multiCheckVal(elem, action, val) {
  133. var items = '';
  134. if (action == 'get') // submitted
  135. {
  136. $("input[type=checkbox]:checked", elem).each(function (i, e)
  137. {
  138. if (items) items += ","
  139. items += e.value;
  140. });
  141. }
  142. else // launched
  143. {
  144. }
  145. return items;
  146. }
  147. function let_val(cellvalue, options, rowObject){
  148. return "2:Reposición;1:Solicitud Inicial;0:test";
  149. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement