Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var mydata = [
- {
- id: "1",
- invdate: "2010-05-24",
- name: "test",
- note: "note",
- tax: "10.00",
- total: "2111.00"},
- {
- id: "2",
- invdate: "2010-05-25",
- name: "test2",
- note: "note2",
- tax: "20.00",
- total: "320.00"},
- {
- id: "3",
- invdate: "2007-09-01",
- name: "test3",
- note: "note3",
- tax: "30.00",
- total: "430.00"},
- {
- id: "4",
- invdate: "2007-10-04",
- name: "test",
- note: "note",
- tax: "10.00",
- total: "210.00"},
- {
- id: "5",
- invdate: "2007-10-05",
- name: "test2",
- note: "note2",
- tax: "20.00",
- total: "320.00"}
- ];
- jQuery("#list47").jqGrid({
- data: mydata,
- datatype: "local",
- height: 150,
- rowNum: 999999,
- scroll: true,
- colNames: ['Inv No', 'Date', 'Client', 'Amount', 'Tax', 'Total','Testing', 'Notes'],
- colModel: [
- {
- name: 'id',
- index: 'id',
- width: 60,
- sorttype: "int"},
- {
- name: 'invdate',
- index: 'invdate',
- width: 90,
- sorttype: "date",
- formatter: "date"},
- {
- name: 'name',
- index: 'name',
- width: 100},
- {
- name: 'amount',
- index: 'amount',
- width: 80,
- align: "right",
- sorttype: "float",
- formatter: "number"},
- {
- name: 'tax',
- index: 'tax',
- width: 80,
- align: "right",
- sorttype: "float"},
- {
- name: 'total',
- index: 'total',
- width: 80,
- align: "right",
- sorttype: "float"},
- { name: "Id_ListaMultiple", index:"Id_ListaMultiple",editable:true,edittype:"custom",editoptions:{custom_element:multiCheckElem, custom_value:multiCheckVal,list:let_val}},
- {
- name: 'note',
- index: 'note',
- width: 150,
- sortable: false}
- ],
- pager: "#plist47",
- //viewrecords: true,
- //multiselect: true,
- caption: "single selection",
- gridComplete: function() {
- $("#list47_cb").css("width","100px");
- $("#list47 tbody tr").children().first("td").css("width","100px");
- }
- });
- jQuery("#list47").jqGrid('navGrid','#plist47',{edit:true,add:true,del:true,search:true});
- function multiCheckElem(values, optio) {
- var id = optio.id;
- alert(values);
- var ctl = '<div id="'+ id + '" class="checklist">';
- var ckboxAry = optio.list.split(';');
- var aValues = [];
- if (values && values.length)
- {
- aValues = values.split(",");
- }
- for (var i = 0; i < ckboxAry.length; i++)
- {
- var item = ckboxAry[i].split(':');
- ctl += '<input type="checkbox" ';
- if (aValues.indexOf(item[0]) != -1)
- {
- if (items) items += ","
- items += e.value;
- });
- }
- else // launched
- {
- }
- return items;
- }
- function let_val(cellvalue, options, rowObject){
- return "2:Reposición;1:Solicitud Inicial;0:test";
- } ctl += 'value="' + item[0] + '"> ' + item[1] + '</input><br/>';
- }
- return ctl + '</div>';
- }
- function multiCheckVal(elem, action, val) {
- var items = '';
- if (action == 'get') // submitted
- {
- $("input[type=checkbox]:checked", elem).each(function (i, e)
- {
- if (items) items += ","
- items += e.value;
- });
- }
- else // launched
- {
- }
- return items;
- }
- function let_val(cellvalue, options, rowObject){
- return "2:Reposición;1:Solicitud Inicial;0:test";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement