Advertisement
GWibisono

jqgrid - 1

Jul 13th, 2015
379
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*using jqgrid 3.8*/
  2. jQuery("#list").jqGrid({
  3.     datatype: "local",
  4.     height: 350,
  5.     colNames: ['Inv No', 'Date', 'Client', 'Amount', 'Tax', 'Total', 'Notes'],
  6.     colModel: [{
  7.         name: 'id',
  8.         index: 'id',
  9.         width: 60,
  10.         sorttype: "int"
  11.     }, {
  12.         name: 'invdate',
  13.         index: 'invdate',
  14.         width: 90,
  15.         sorttype: "date"
  16.     }, {
  17.         name: 'name',
  18.         index: 'name',
  19.         width: 100
  20.     }, {
  21.         name: 'amount',
  22.         index: 'amount',
  23.         width: 80,
  24.         align: "right",
  25.         sorttype: "float"
  26.     }, {
  27.         name: 'tax',
  28.         index: 'tax',
  29.         width: 80,
  30.         align: "right",
  31.         sorttype: "float"
  32.     }, {
  33.         name: 'total',
  34.         index: 'total',
  35.         width: 80,
  36.         align: "right",
  37.         sorttype: "float"
  38.     }, {
  39.         name: 'note',
  40.         index: 'note',
  41.         width: 150,
  42.         sortable: false
  43.     }],
  44.     multiselect: true,
  45.     caption: "Manipulating Array Data",
  46.  
  47. });
  48.  
  49. var mydata = [{
  50.     id: "1",
  51.     invdate: "2007-10-01",
  52.     name: "test",
  53.     note: "note",
  54.     amount: "200.00",
  55.     tax: "10.00",
  56.     total: "210.00"
  57. }, {
  58.     id: "2",
  59.     invdate: "2007-10-02",
  60.     name: "test2",
  61.     note: "note2",
  62.     amount: "300.00",
  63.     tax: "20.00",
  64.     total: "320.00"
  65. }, {
  66.     id: "3",
  67.     invdate: "2007-09-01",
  68.     name: "test3",
  69.     note: "note3",
  70.     amount: "400.00",
  71.     tax: "30.00",
  72.     total: "430.00"
  73. }, {
  74.     id: "4",
  75.     invdate: "2007-10-04",
  76.     name: "test",
  77.     note: "note",
  78.     amount: "200.00",
  79.     tax: "10.00",
  80.     total: "210.00"
  81. }, {
  82.     id: "5",
  83.     invdate: "2007-10-05",
  84.     name: "test2",
  85.     note: "note2",
  86.     amount: "300.00",
  87.     tax: "20.00",
  88.     total: "320.00"
  89. }, {
  90.     id: "6",
  91.     invdate: "2007-09-06",
  92.     name: "test3",
  93.     note: "note3",
  94.     amount: "400.00",
  95.     tax: "30.00",
  96.     total: "430.00"
  97. }, {
  98.     id: "7",
  99.     invdate: "2007-10-04",
  100.     name: "test",
  101.     note: "note",
  102.     amount: "200.00",
  103.     tax: "10.00",
  104.     total: "210.00"
  105. }, {
  106.     id: "8",
  107.     invdate: "2007-10-03",
  108.     name: "test2",
  109.     note: "note2",
  110.     amount: "300.00",
  111.     tax: "20.00",
  112.     total: "320.00"
  113. }, {
  114.     id: "9",
  115.     invdate: "2007-09-01",
  116.     name: "test3",
  117.     note: "note3",
  118.     amount: "400.00",
  119.     tax: "30.00",
  120.     total: "430.00"
  121. }];
  122. for (var i = 0; i <= mydata.length; i++)
  123. jQuery("#list").jqGrid('addRowData', i + 1, mydata[i]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement