-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path40keyboard.html
50 lines (49 loc) · 1.58 KB
/
40keyboard.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
<div style="font-size:12px;">
With the help of the new method bindKeys we can navigate trough the grid and define
different actions for certain keys.<br/>
In this example : Select a row and try to use Up and Down keys to navigate trough the
grid rows. When a Enter key is pressed a alert appear.
</div>
<br />
<table id="keynav"></table>
<div id="pkeynav"></div>
<script src="40keyboard.js" type="text/javascript"> </script>
<br />
<div style="font-size:12px;">
<b> HTML </b>
<XMP>
<table id="newapi"></table>
<div id="pnewapi"></div>
</XMP>
<b>Java Scrpt code</b>
<XMP>
jQuery("#keynav").jqGrid({
url:'server.php?q=4',
datatype: "json",
colNames:['Inv No', 'Date', 'Client', 'Amount','Tax','Total','Notes'],
colModel:[
{name:'id', key : true, index:'id', width:55},
{name:'invdate',index:'invdate', width:90},
{name:'name', index:'name', width:100},
{name:'amount',index:'amount', width:80, align:"right"},
{name:'tax',index:'tax', width:80, align:"right"},
{name:'total',index:'total', width:80,align:"right"},
{name:'note',index:'note', width:150, sortable:false}
],
rowNum:10,
width:700,
rowList:[10,20,30],
pager: '#pkeynav',
sortname: 'invdate',
viewrecords: true,
sortorder: "desc",
jsonReader: {
repeatitems : false
},
caption: "Keyboard Navigation",
height: '100%'
});
jQuery("#keynav").jqGrid('navGrid','#pkeynav',{edit:false,add:false,del:false});
// Bind the navigation and set the onEnter event
jQuery("#keynav").jqGrid('bindKeys', {"onEnter":function( rowid ) { alert("You enter a row with id:"+rowid)} } );
</XMP>