-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path36custinput.js
36 lines (36 loc) · 1.25 KB
/
36custinput.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
var lastsel;
function my_input(value, options) {
return $("<input type='text' size='10' value='"+value+"'/>");
}
function my_value(value) {
return "My value: "+value.val();
}
jQuery("#cinput").jqGrid({
url:'server.php?q=2',
datatype: "json",
colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'],
colModel:[
{name:'id',index:'id', width:55, editable:true},
{name:'invdate',index:'invdate', width:90,editable:true},
{name:'name',index:'name asc, invdate', width:100,editable:true, edittype:'custom', editoptions:{custom_element:my_input,custom_value:my_value}},
{name:'amount',index:'amount', width:80, align:"right",editable:true},
{name:'tax',index:'tax', width:80, align:"right",editable:true},
{name:'total',index:'total', width:80,align:"right",editable:true},
{name:'note',index:'note', width:150, sortable:false,editable:true}
],
onSelectRow: function(id){
if(id && id!==lastsel){
jQuery('#cinput').jqGrid('restoreRow',lastsel);
jQuery('#cinput').jqGrid('editRow',id,true);
lastsel=id;
}
},
rowNum:10,
rowList:[10,20,30],
pager: '#pcinput',
sortname: 'invdate',
viewrecords: true,
sortorder: "desc",
caption:"Custom Input",
editurl: "server.php?q=dummy"
});