forked from tonytomov/jqGrid
-
Notifications
You must be signed in to change notification settings - Fork 1
/
sample.html
89 lines (80 loc) · 5.3 KB
/
sample.html
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/themes/base/jquery-ui.css" type="text/css" media="all" />
<link rel="stylesheet" href="css/ui.jqgrid.css" type="text/css" media="all" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script>
<script src="jquery.jqGrid.js"></script>
</head>
<body>
<input type="BUTTON" id="bedata" value="Edit Selected" />
<input type="BUTTON" id="uibedata" value="Edit Selected UI" />
<input type="BUTTON" id="intbedata" value="Edit Selected Internal" />
<table id="editgrid"></table> <div id="pagered"></div>
</body>
<script>
jQuery("#editgrid").jqGrid({
url : 'http://www.trirand.com/blog/jqgrid/editing.php?q=1',
datatype : "xmlstring",
datastr : "<?xml version='1.0' encoding='utf-8'?><rows><page>1</page><total>2</total><records>13</records><row id='13'><cell>13</cell><cell>2007-10-06</cell><cell><![CDATA[Client 3]]></cell><cell>1000.00</cell><cell>0.00</cell><cell>1000.00</cell><cell>No</cell><cell>TNT</cell><cell><![CDATA[]]></cell></row><row id='12'><cell>12</cell><cell>2007-10-06</cell><cell><![CDATA[Client 2]]></cell><cell>700.00</cell><cell>140.00</cell><cell>840.00</cell><cell>No</cell><cell>FedEx</cell><cell><![CDATA[]]></cell></row><row id='11'><cell>11</cell><cell>2007-10-06</cell><cell><![CDATA[Client 1]]></cell><cell>600.00</cell><cell>120.00</cell><cell>720.00</cell><cell>No</cell><cell>FedEx</cell><cell><![CDATA[]]></cell></row><row id='10'><cell>10</cell><cell>2007-10-06</cell><cell><![CDATA[Client 2]]></cell><cell>100.00</cell><cell>20.00</cell><cell>120.00</cell><cell>Yes</cell><cell>TNT</cell><cell><![CDATA[]]></cell></row><row id='9'><cell>9</cell><cell>2007-10-06</cell><cell><![CDATA[Client 1]]></cell><cell>200.00</cell><cell>40.00</cell><cell>240.00</cell><cell>No</cell><cell>TNT</cell><cell><![CDATA[]]></cell></row><row id='8'><cell>8</cell><cell>2007-10-06</cell><cell><![CDATA[Client 3]]></cell><cell>200.00</cell><cell>0.00</cell><cell>200.00</cell><cell>No</cell><cell>FedEx</cell><cell><![CDATA[]]></cell></row><row id='7'><cell>7</cell><cell>2007-10-05</cell><cell><![CDATA[Client 2]]></cell><cell>120.00</cell><cell>12.00</cell><cell>134.00</cell><cell>Yes</cell><cell>TNT</cell><cell><![CDATA[]]></cell></row><row id='6'><cell>6</cell><cell>2007-10-05</cell><cell><![CDATA[Client 1]]></cell><cell>50.00</cell><cell>10.00</cell><cell>60.00</cell><cell>No</cell><cell>FedEx</cell><cell><![CDATA[]]></cell></row><row id='5'><cell>5</cell><cell>2007-10-05</cell><cell><![CDATA[Client 3]]></cell><cell>100.00</cell><cell>0.00</cell><cell>100.00</cell><cell>No</cell><cell>FedEx</cell><cell><![CDATA[no tax at all]]></cell></row><row id='4'><cell>4</cell><cell>2007-10-04</cell><cell><![CDATA[Client 3]]></cell><cell>150.00</cell><cell>0.00</cell><cell>150.00</cell><cell>Yes</cell><cell>TNT</cell><cell><![CDATA[no tax]]></cell></row></rows>",
colNames : ['Inv No','Date', 'Client', 'Amount','Tax','Total','Closed','Ship via','Notes'],
colModel : [
{name:'id',index:'id', width:55,editable:false,editoptions:{readonly:true,size:10}},
{name:'invdate',index:'invdate', width:80,editable:true,editoptions:{size:10}},
{name:'name',index:'name', width:90,editable:true,editoptions:{size:25}},
{name:'amount',index:'amount', width:60, align:"right",editable:true,editoptions:{size:10}},
{name:'tax',index:'tax', width:60, align:"right",editable:true,editoptions:{size:10}},
{name:'total',index:'total', width:60,align:"right",editable:true,editoptions:{size:10}},
{name:'closed',index:'closed',width:55,align:'center',editable:true,edittype:"checkbox",editoptions:{value:"Yes:No"}},
{name:'ship_via',index:'ship_via',width:70, editable: true,edittype:"select",editoptions:{value:"FE:FedEx;TN:TNT"}},
{name:'note',index:'note', width:100, sortable:false,editable: true,edittype:"textarea", editoptions:{rows:"2",cols:"20"}} ],
rowNum : 10,
rowList : [10,20,30],
pager : '#pagered',
sortname : 'id',
viewrecords : true,
sortorder : "desc",
caption : "Editing Example",
editurl : "someurl.php"
});
$("#bedata").click(function(){
var gr = jQuery("#editgrid").jqGrid('getGridParam','selrow');
if( gr != null )
jQuery("#editgrid").jqGrid('editGridRow',gr,{
//dialogEngine : "ui",
height : 280 ,
reloadAfterSubmit : false,
recreateForm : true
}
);
else alert("Please Select Row");
});
$("#uibedata").click(function(){
var gr = jQuery("#editgrid").jqGrid('getGridParam','selrow');
if( gr != null )
jQuery("#editgrid").jqGrid('editGridRow',gr,{
dialogEngine : "ui",
height : 280 ,
reloadAfterSubmit : false,
recreateForm : true
}
);
else alert("Please Select Row");
});
$("#intbedata").click(function(){
var gr = jQuery("#editgrid").jqGrid('getGridParam','selrow');
if( gr != null )
jQuery("#editgrid").jqGrid('editGridRow',gr,{
//dialogEngine : "ui",
jqModal : false,
height : 280 ,
reloadAfterSubmit : false,
recreateForm : true
}
);
else alert("Please Select Row");
});
</script>
</html>