code
stringlengths
1
2.01M
repo_name
stringlengths
3
62
path
stringlengths
1
267
language
stringclasses
231 values
license
stringclasses
13 values
size
int64
1
2.01M
<div style="font-size:12px;"> This example demostrates how we can manipulate data at client side. To synchronize the manipulation on server<br> we must write custom code. </div> <br /> <table id="list5"></table> <div id="pager5"></div> <br /> <a href="#" id="a1">Get data from selected row</a> <br /> <a href="#" id="a2">Delete row 12</a> <br /> <a href="#" id="a3">Update amounts in row 11</a> <br /> <a href="#" id="a4">Add row with id 99</a> <script src="manipex.js" type="text/javascript"> </script> <br /> <br /> <div style="font-size:12px;"> <b> HTML </b> <XMP> ... <table id="list5"></table> <div id="pager5"></div> <br /> <a href="#" id="a1">Get data from selected row</a> <br /> <a href="#" id="a2">Delete row 2</a> <br /> <a href="#" id="a3">Update amounts in row 1</a> <br /> <a href="#" id="a4">Add row with id 99</a> <script src="manipex.js" type="text/javascript"> </script> <br /> </XMP> <b>Java Scrpt code</b> <XMP> ... jQuery("#list5").jqGrid({ url:'server.php?q=2', datatype: "json", colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',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, rowList:[10,20,30], pager: '#pager5', sortname: 'id', viewrecords: true, sortorder: "desc", caption:"Simple data manipulation", editurl:"someurl.php" }).navGrid("#pager5",{edit:false,add:false,del:false}); jQuery("#a1").click( function(){ var id = jQuery("#list5").jqGrid('getGridParam','selrow'); if (id) { var ret = jQuery("#list5").jqGrid('getRowData',id); alert("id="+ret.id+" invdate="+ret.invdate+"..."); } else { alert("Please select row");} }); jQuery("#a2").click( function(){ var su=jQuery("#list5").jqGrid('delRowData',12); if(su) alert("Succes. Write custom code to delete row from server"); else alert("Allready deleted or not in list"); }); jQuery("#a3").click( function(){ var su=jQuery("#list5").jqGrid('setRowData',11,{amount:"333.00",tax:"33.00",total:"366.00",note:"<img src='images/user1.gif'/>"}); if(su) alert("Succes. Write custom code to update row in server"); else alert("Can not update"); }); jQuery("#a4").click( function(){ var datarow = {id:"99",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}; var su=jQuery("#list5").jqGrid('addRowData',99,datarow); if(su) alert("Succes. Write custom code to add data in server"); else alert("Can not update"); }); </XMP> <b>PHP with MySQL</b> <XMP> ... $page = $_GET['page']; // get the requested page $limit = $_GET['rows']; // get how many rows we want to have into the grid $sidx = $_GET['sidx']; // get index row - i.e. user click to sort $sord = $_GET['sord']; // get the direction if(!$sidx) $sidx =1; // connect to the database $db = mysql_connect($dbhost, $dbuser, $dbpassword) or die("Connection Error: " . mysql_error()); mysql_select_db($database) or die("Error conecting to db."); $result = mysql_query("SELECT COUNT(*) AS count FROM invheader a, clients b WHERE a.client_id=b.client_id"); $row = mysql_fetch_array($result,MYSQL_ASSOC); $count = $row['count']; if( $count >0 ) { $total_pages = ceil($count/$limit); } else { $total_pages = 0; } if ($page > $total_pages) $page=$total_pages; $start = $limit*$page - $limit; // do not put $limit*($page - 1) $SQL = "SELECT a.id, a.invdate, b.name, a.amount,a.tax,a.total,a.note FROM invheader a, clients b WHERE a.client_id=b.client_id ORDER BY $sidx $sord LIMIT $start , $limit"; $result = mysql_query( $SQL ) or die("Couldn t execute query.".mysql_error()); $responce->page = $page; $responce->total = $total_pages; $responce->records = $count; $i=0; while($row = mysql_fetch_array($result,MYSQL_ASSOC)) { $responce->rows[$i]['id']=$row[id]; $responce->rows[$i]['cell']=array($row[id],$row[invdate],$row[name],$row[amount],$row[tax],$row[total],$row[note]); $i++; } echo json_encode($responce); ... </XMP> </div>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/manipex.html
HTML
art
4,387
<div style="font-size:12px;"> This example demonstartes a new filterToolbar method. When we call this method the search<br> is placed above the header columns. This method is similar to filterGrid, but resolves the issue<br> related when we resize the coulmns. </div> <br /> <table id="s3list"></table> <div id="s3pager"></div> <script src="search3.js" type="text/javascript"> </script> <br /> <div style="font-size:12px;"> <b> HTML </b> <XMP> <table id="s2list"></table> <div id="s2pager"></div> <div id="filter" style="margin-left:30%;display:none">Search Invoices</div> <script src="search2.js" type="text/javascript"> </script> </XMP> <b>Java Scrpt code</b> <XMP> ... var mygrid = jQuery("#s3list").jqGrid({ url:'search.php?q=1', datatype: "json", width: 700, colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',index:'id', width:65}, {name:'invdate',index:'invdate', width:90,searchoptions:{dataInit:function(el){$(el).datepicker({dateFormat:'yy-mm-dd'});} }}, {name:'name',index:'name', width:100}, {name:'amount',index:'amount', width:80, align:"right"}, {name:'tax',index:'tax', width:80, align:"right", stype:'select', editoptions:{value:":All;0.00:0.00;12:12.00;20:20.00;40:40.00;60:60.00;120:120.00"}}, {name:'total',index:'total', width:80,align:"right"}, {name:'note',index:'note', width:150, sortable:false} ], rowNum:10, mtype: "POST", rowList:[10,20,30], pager: '#s3pager', sortname: 'id', viewrecords: true, rownumbers: true, sortorder: "desc", gridview : true, caption:"Toolbar Search Example" }); jQuery("#s3list").jqGrid('navGrid','#s3pager',{edit:false,add:false,del:false,search:false,refresh:false}); jQuery("#s3list").jqGrid('navButtonAdd',"#s3pager",{caption:"Toggle",title:"Toggle Search Toolbar", buttonicon :'ui-icon-pin-s', onClickButton:function(){ mygrid[0].toggleToolbar() } }); jQuery("#s3list").jqGrid('navButtonAdd',"#s3pager",{caption:"Clear",title:"Clear Search",buttonicon :'ui-icon-refresh', onClickButton:function(){ mygrid[0].clearToolbar() } }); jQuery("#s3list").jqGrid('filterToolbar'); </XMP> <b>PHP with MySQL</b> <XMP> See Multiple search in What is new in 3.3 version. </XMP> </div>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/search3.html
HTML
art
2,353
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"}, {id:"6",invdate:"2007-09-06",name:"test3",note:"note3",tax:"30.00",total:"430.00"}, {id:"7",invdate:"2007-10-04",name:"test",note:"note",tax:"10.00",total:"210.00"}, {id:"8",invdate:"2007-10-03",name:"test2",note:"note2",amount:"300.00",tax:"21.00",total:"320.00"}, {id:"9",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}, {id:"11",invdate:"2007-10-01",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"}, {id:"12",invdate:"2007-10-02",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"}, {id:"13",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}, {id:"14",invdate:"2007-10-04",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"}, {id:"15",invdate:"2007-10-05",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"}, {id:"16",invdate:"2007-09-06",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}, {id:"17",invdate:"2007-10-04",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"}, {id:"18",invdate:"2007-10-03",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"}, {id:"19",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}, {id:"21",invdate:"2007-10-01",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"}, {id:"22",invdate:"2007-10-02",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"}, {id:"23",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}, {id:"24",invdate:"2007-10-04",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"}, {id:"25",invdate:"2007-10-05",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"}, {id:"26",invdate:"2007-09-06",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}, {id:"27",invdate:"2007-10-04",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"}, {id:"28",invdate:"2007-10-03",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"}, {id:"29",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"} ]; jQuery("#list486").jqGrid({ data: mydata, datatype: "local", height: 'auto', rowNum: 30, rowList: [10,20,30], colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','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, editable:true}, {name:'amount',index:'amount', width:80, align:"right",sorttype:"float", formatter:"number", editable:true, summaryType:'min', summaryTpl:'<b>Min: {0}</b>'}, {name:'tax',index:'tax', width:80, align:"right",sorttype:"float",formatter:"number", editable:true, summaryType:'max', summaryTpl:'<b>Max: {0}</b>'}, {name:'total',index:'total', width:80,align:"right",sorttype:"float", formatter:"number", summaryType:'sum'}, {name:'note',index:'note', width:150, sortable:false, summaryType:'count', summaryTpl:'<b>{0} Item(s)</b>'} ], pager: "#plist486", viewrecords: true, sortname: 'name', grouping:true, groupingView : { groupField : ['name'], groupSummary : [true], groupColumnShow : [true], groupText : ['<b>{0}</b>'], groupCollapse : false, groupOrder: ['asc'] }, caption: "Summary footers" });
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/38array6.js
JavaScript
art
4,002
jQuery("#editgrid").jqGrid({ url:'editing.php?q=1', datatype: "xml", 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,{height:280,reloadAfterSubmit:false}); else alert("Please Select Row"); });
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/editing.js
JavaScript
art
1,560
<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>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/40keyboard.html
HTML
art
1,670
jQuery("#s1list").jqGrid({ url:'search.php?q=1', datatype: "json", colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',index:'id', width:65}, {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", edittype:'select', editoptions:{value:":All;0.00:0.00;12:12.00;20:20.00;40:40.00;60:60.00;120:120.00"}}, {name:'total',index:'total', width:80,align:"right"}, {name:'note',index:'note', width:150, sortable:false} ], rowNum:10, mtype: "POST", rowList:[10,20,30], pager: '#s1pager', sortname: 'id', viewrecords: true, toolbar : [true,"top"], sortorder: "desc", caption:"Multiple Toolbar Search Example" }); jQuery("#t_s1list").height(25).hide().jqGrid('filterGrid',"s1list",{gridModel:true,gridToolbar:true}); jQuery("#sg_invdate").datepicker({dateFormat:"yy-mm-dd"}); jQuery("#s1list").jqGrid('navGrid','#s1pager',{edit:false,add:false,del:false,search:false,refresh:false}); jQuery("#s1list").jqGrid('navButtonAdd',"#s1pager",{caption:"Search",title:"Toggle Search", onClickButton:function(){ if(jQuery("#t_s1list").css("display")=="none") { jQuery("#t_s1list").css("display",""); } else { jQuery("#t_s1list").css("display","none"); } } });
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/search1.js
JavaScript
art
1,461
jQuery("#s2list").jqGrid({ url:'search.php?q=1', datatype: "json", colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',index:'id', width:65}, {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", edittype:'select', editoptions:{value:":All;0.00:0.00;12:12.00;20:20.00;40:40.00;60:60.00;120:120.00"}}, {name:'total',index:'total', width:80,align:"right"}, {name:'note',index:'note', width:150, sortable:false} ], rowNum:10, mtype: "POST", rowList:[10,20,30], pager: '#s2pager', sortname: 'id', viewrecords: true, sortorder: "desc", caption:"Multiple Form Search Example", onHeaderClick: function (stat) { if(stat == 'visible' ){ jQuery("#filter").css("display","none"); } } }) jQuery("#s2list").jqGrid('navGrid','#s2pager',{edit:false,add:false,del:false,search:false,refresh:false}); jQuery("#s2list").jqGrid('navButtonAdd',"#s2pager",{caption:"Search",title:"Toggle Search", onClickButton:function(){ if(jQuery("#filter").css("display")=="none") { jQuery(".HeaderButton","#gbox_s2list").trigger("click"); jQuery("#filter").show(); } } }); jQuery("#s2list").jqGrid('navButtonAdd',"#s2pager",{caption:"Clear",title:"Clear Search",buttonicon:'ui-icon-refresh', onClickButton:function(){ var stat = jQuery("#s2list").getGridParam('search'); if(stat) { var cs = jQuery("#filter")[0]; cs.clearSearch(); } } }); jQuery("#filter").jqGrid('filterGrid',"s2list", { gridModel:true, gridNames:true, formtype:"vertical", enableSearch:true, enableClear:false, autosearch: false, afterSearch : function() { jQuery(".HeaderButton","#gbox_s2list").trigger("click"); jQuery("#filter").css("display","none"); } } ); jQuery("#sg_invdate","#filter").datepicker({dateFormat:"yy-mm-dd"});
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/search2.js
JavaScript
art
2,069
<div style="font-size:12px;"> It is possible to expand all the rows automatically when the rows are loaded. <br/> This is done just with one option - see the code. </div> <br /> <table id="sg2"></table> <div id="psg2"></div> <script src="40subgrid2.js" type="text/javascript"> </script> <br /> <div style="font-size:12px;"> <b> HTML </b> <XMP> ... <table id="sg1"></table> <div id="psg1"></div> ... </XMP> <b>Java Scrpt code</b> <XMP> jQuery("#sg2").jqGrid({ url:'server.php?q=1', datatype: "xml", height: 190, colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',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:8, rowList:[8,10,20,30], pager: '#psg2', sortname: 'id', viewrecords: true, sortorder: "desc", multiselect: false, subGrid: true, caption: "Custom Icons in Subgrid", // define the icons in subgrid subGridOptions: { "plusicon" : "ui-icon-triangle-1-e", "minusicon" : "ui-icon-triangle-1-s", "openicon" : "ui-icon-arrowreturn-1-e", //expand all rows on load "expandOnLoad" : true }, subGridRowExpanded: function(subgrid_id, row_id) { var subgrid_table_id, pager_id; subgrid_table_id = subgrid_id+"_t"; pager_id = "p_"+subgrid_table_id; $("#"+subgrid_id).html("<table id='"+subgrid_table_id+"' class='scroll'></table><div id='"+pager_id+"' class='scroll'></div>"); jQuery("#"+subgrid_table_id).jqGrid({ url:"subgrid.php?q=2&id="+row_id, datatype: "xml", colNames: ['No','Item','Qty','Unit','Line Total'], colModel: [ {name:"num",index:"num",width:80,key:true}, {name:"item",index:"item",width:130}, {name:"qty",index:"qty",width:70,align:"right"}, {name:"unit",index:"unit",width:70,align:"right"}, {name:"total",index:"total",width:70,align:"right",sortable:false} ], rowNum:20, pager: pager_id, sortname: 'num', sortorder: "asc", height: '100%' }); jQuery("#"+subgrid_table_id).jqGrid('navGrid',"#"+pager_id,{edit:false,add:false,del:false}) } }); jQuery("#sg2").jqGrid('navGrid','#psg2',{add:false,edit:false,del:false}); </XMP> <b>PHP with MySQL Master</b> <XMP> ... $page = $_GET['page']; // get the requested page $limit = $_GET['rows']; // get how many rows we want to have into the grid $sidx = $_GET['sidx']; // get index row - i.e. user click to sort $sord = $_GET['sord']; // get the direction if(!$sidx) $sidx =1; // connect to the database $db = mysql_connect($dbhost, $dbuser, $dbpassword) or die("Connection Error: " . mysql_error()); mysql_select_db($database) or die("Error conecting to db."); $result = mysql_query("SELECT COUNT(*) AS count FROM invheader a, clients b WHERE a.client_id=b.client_id"); $row = mysql_fetch_array($result,MYSQL_ASSOC); $count = $row['count']; if( $count >0 ) { $total_pages = ceil($count/$limit); } else { $total_pages = 0; } if ($page > $total_pages) $page=$total_pages; $start = $limit*$page - $limit; // do not put $limit*($page - 1) if ($start < 0) $start = 0; $SQL = "SELECT a.id, a.invdate, b.name, a.amount,a.tax,a.total,a.note FROM invheader a, clients b WHERE a.client_id=b.client_id ORDER BY $sidx $sord LIMIT $start , $limit"; $result = mysql_query( $SQL ) or die("Couldn’t execute query.".mysql_error()); if ( stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml") ) { header("Content-type: application/xhtml+xml;charset=utf-8"); } else { header("Content-type: text/xml;charset=utf-8"); } $et = ">"; echo "<?xml version='1.0' encoding='utf-8'?$et\n"; echo "<rows>"; echo "<page>".$page."</page>"; echo "<total>".$total_pages."</total>"; echo "<records>".$count."</records>"; // be sure to put text data in CDATA while($row = mysql_fetch_array($result,MYSQL_ASSOC)) { echo "<row id='". $row[id]."'>"; echo "<cell>". $row[id]."</cell>"; echo "<cell>". $row[invdate]."</cell>"; echo "<cell><![CDATA[". $row[name]."]]></cell>"; echo "<cell>". $row[amount]."</cell>"; echo "<cell>". $row[tax]."</cell>"; echo "<cell>". $row[total]."</cell>"; echo "<cell><![CDATA[". $row[note]."]]></cell>"; echo "</row>"; } echo "</rows>"; </XMP> <b>PHP with MySQL Subgrid</b> <XMP> $examp = $_GET["q"]; //query number $id = $_GET['id']; // connect to the database $db = mysql_connect($dbhost, $dbuser, $dbpassword) or die("Connection Error: " . mysql_error()); mysql_select_db($database) or die("Error conecting to db."); $SQL = "SELECT num, item, qty, unit FROM invlines WHERE id=".$id." ORDER BY item"; $result = mysql_query( $SQL ) or die("Couldn’t execute query.".mysql_error()); if ( stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml") ) { header("Content-type: application/xhtml+xml;charset=utf-8"); } else { header("Content-type: text/xml;charset=utf-8"); } $et = ">"; echo "<?xml version='1.0' encoding='utf-8'?$et\n"; echo "<rows>"; // be sure to put text data in CDATA while($row = mysql_fetch_array($result,MYSQL_ASSOC)) { echo "<row>"; echo "<cell>". $row[num]."</cell>"; echo "<cell><![CDATA[". $row[item]."]]></cell>"; echo "<cell>". $row[qty]."</cell>"; echo "<cell>". $row[unit]."</cell>"; echo "<cell>". number_format($row[qty]*$row[unit],2,'.',' ')."</cell>"; echo "</row>"; } echo "</rows>"; </XMP> </div>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/40subgrid2.html
HTML
art
5,709
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <link rel="stylesheet" type="text/css" media="screen" href="http://www.trirand.com/jqgrid35/themes/redmond/jquery-ui-1.7.1.custom.css" /> <link rel="stylesheet" type="text/css" media="screen" href="http://www.trirand.com/jqgrid35/themes/ui.jqgrid.css" /> <script src="http://www.trirand.com/jqgrid35/js/jquery.js" type="text/javascript"></script> <script src="http://www.trirand.com/jqgrid35/js/jquery-ui-1.7.1.custom.min.js" type="text/javascript"></script> <script src="http://www.trirand.com/jqgrid35/js/jquery.layout.js" type="text/javascript"></script> <script src="http://www.trirand.com/jqgrid35/js/i18n/grid.locale-en.js" type="text/javascript"></script> <script src="http://www.trirand.com/jqgrid35/js/jquery.jqGrid.min.js" type="text/javascript"></script> <script src="http://www.trirand.com/jqgrid35/js/jquery.tablednd.js" type="text/javascript"></script> <script src="http://www.trirand.com/jqgrid35/js/jquery.contextmenu.js" type="text/javascript"></script> <script src="http://www.trirand.com/jqgrid35/js/jquery.contextmenu.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function() { $("#celltbl").jqGrid({ datatype: "local", colNames: ['Inv No', 'Date', 'Client', 'Amount', 'Tax', 'Total', 'Notes'], colModel: [{ name: 'id', index: 'id', width: 55 }, { name: 'invdate', index: 'invdate', width: 90, editable: true }, { name: 'name', index: 'name asc, invdate', width: 100 }, { name: 'amount', index: 'amount', width: 80, align: "right", editable: true, editrules: { number: true} }, { name: 'tax', index: 'tax', width: 80, align: "right", editable: true, editrules: { number: true} }, { name: 'total', index: 'total', width: 80, align: "right" }, { name: 'note', index: 'note', width: 150, sortable: false}], rowNum: 10, rowList: [10, 20, 30], sortname: 'id', viewrecords: true, sortorder: "desc", caption: "Cell Edit Example", cellEdit: true, cellurl: 'server.php' }); var mydata = [{ id: "1", invdate: "2007-10-01", name: "test", note: "note", amount: "200.00", tax: "10.00", total: "210.00" }, { id: "2", invdate: "2007-10-02", name: "test2", note: "note2", amount: "300.00", tax: "20.00", total: "320.00" }, { id: "3", invdate: "2007-09-01", name: "test3", note: "note3", amount: "400.00", tax: "30.00", total: "430.00" }, { id: "4", invdate: "2007-10-04", name: "test", note: "note", amount: "200.00", tax: "10.00", total: "210.00" }, { id: "5", invdate: "2007-10-05", name: "test2", note: "note2", amount: "300.00", tax: "20.00", total: "320.00" }, { id: "6", invdate: "2007-09-06", name: "test3", note: "note3", amount: "400.00", tax: "30.00", total: "430.00" }, { id: "7", invdate: "2007-10-04", name: "test", note: "note", amount: "200.00", tax: "10.00", total: "210.00" }, { id: "8", invdate: "2007-10-03", name: "test2", note: "note2", amount: "300.00", tax: "20.00", total: "320.00" }, { id: "9", invdate: "2007-09-01", name: "test3", note: "note3", amount: "400.00", tax: "30.00", total: "430.00"}]; for (var i = 0; i <= mydata.length; i++) $("#celltbl").addRowData(i + 1, mydata[i]); }); </script> </head> <body> <h1>Double-Post on Cell Edit Bug</h1> <table id="celltbl"></table> </body> </html>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/cellbug.html
HTML
art
3,490
<div style="font-size:12px;"> In case when the server response can not be controlled, jqGrid can perform grouping too <br/> using his own sorting procedure.<br/><br/> </div> <br /> <table id="48remote3"></table> <div id="p48remote3"></div> <script src="38remote3.js" type="text/javascript"></script> <br /> <div style="font-size:12px;"> <b> HTML </b> <XMP> ... <table id="48remote3"></table> <div id="p48remote3"></div> </XMP> <b>Java Scrpt code</b> <XMP> jQuery("#48remote3").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, sorttype:'int',summaryType:'count', summaryTpl : '({0}) total'}, {name:'invdate',index:'invdate', width:90, sorttype:'date', formatter:'date', datefmt:'d/m/Y'}, {name:'name',index:'name', width:100}, {name:'amount',index:'amount', width:80, align:"right", sorttype:'number',formatter:'number',summaryType:'sum'}, {name:'tax',index:'tax', width:80, align:"right",sorttype:'number',formatter:'number',summaryType:'sum'}, {name:'total',index:'total', width:80,align:"right",sorttype:'number',formatter:'number', summaryType:'sum'}, {name:'note',index:'note', width:150, sortable:false,editable:true} ], rowNum:10, rowList:[10,20,30], height: 'auto', pager: '#p48remote3', sortname: 'invdate', viewrecords: true, sortorder: "desc", caption:"Grouping with remote data - not sorted", grouping: true, groupingView : { groupField : ['name'], groupColumnShow : [true], groupText : ['<b>{0}</b>'], groupCollapse : false, groupOrder: ['asc'], groupSummary : [true], groupDataSorted : false }, footerrow: true, userDataOnFooter: true }); jQuery("#48remote3").jqGrid('navGrid','#p48remote3',{add:false,edit:false,del:false}); </XMP> <b>PHP MySQL code</b> <XMP> examp = $_REQUEST["q"]; //query number $page = $_REQUEST['page']; // get the requested page $limit = $_REQUEST['rows']; // get how many rows we want to have into the grid $sidx = $_REQUEST['sidx']; // get index row - i.e. user click to sort $sord = $_REQUEST['sord']; // get the direction if(!$sidx) $sidx =1; ... $result = mysql_query("SELECT COUNT(*) AS count FROM invheader a, clients b WHERE a.client_id=b.client_id".$wh); $row = mysql_fetch_array($result,MYSQL_ASSOC); $count = $row['count']; if( $count >0 ) { $total_pages = ceil($count/$limit); } else { $total_pages = 0; } if ($page > $total_pages) $page=$total_pages; $start = $limit*$page - $limit; // do not put $limit*($page - 1) if ($start<0) $start = 0; $SQL = "SELECT a.id, a.invdate, b.name, a.amount,a.tax,a.total,a.note FROM invheader a, clients b WHERE a.client_id=b.client_id".$wh." ORDER BY ".$sidx." ".$sord. " LIMIT ".$start." , ".$limit; $result = mysql_query( $SQL ) or die("Could not execute query.".mysql_error()); $responce->page = $page; $responce->total = $total_pages; $responce->records = $count; $i=0; $amttot=0; $taxtot=0; $total=0; while($row = mysql_fetch_array($result,MYSQL_ASSOC)) { $amttot += $row[amount]; $taxtot += $row[tax]; $total += $row[total]; $responce->rows[$i]['id']=$row[id]; $responce->rows[$i]['cell']=array($row[id],$row[invdate],$row[name],$row[amount],$row[tax],$row[total],$row[note]); $i++; } $responce->userdata['amount'] = $amttot; $responce->userdata['tax'] = $taxtot; $responce->userdata['total'] = $total; $responce->userdata['name'] = 'Totals:'; echo json_encode($responce); </XMP> </div>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/38remote3.html
HTML
art
3,658
<div style="font-size:12px;"> This example show the new feature of jqGrid forceFit. Try to resize a column. <br> We can see that the adjacent column (to the right) resizes so that the overall grid width is maintained <br> Again with this we can set the width and height dynamically. <br> Another feature here is that we can apply a sort to a certain column instead of clicking on <br> another one. Click on date colummn. The sort is not by date, but of client name. </div> <br /> <table id="gwidth"></table> <div id="pgwidth"></div> <br/> <input id="setwidth" type="text" /><input type="button" id="snw" value="Set New Width"/> <br/> <input id="setheight" type="text" /><input type="button" id="snh" value="Set New Height"/> <script src="gridwidth.js" type="text/javascript"> </script> <br /> <div style="font-size:12px;"> <b> HTML </b> <XMP> ... <table id="gwidth"></table> <div id="pgwidth"></div> <br/> <input id="setwidth" type="text" /><input type="button" id="snw" value="Set New Width"/> <br/> <input id="setheight" type="text" /><input type="button" id="snh" value="Set New Height"/> <script src="gridwidth.js" type="text/javascript"> </script> </XMP> <b>Java Scrpt code</b> <XMP> ... jQuery("#gwidth").jqGrid({ url:'server.php?q=2', datatype: "json", colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',index:'id', width:55}, {name:'invdate',index:'invdate', width:90}, {name:'name',index:'name asc, invdate', 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, rowList:[10,20,30], pager: '#pgwidth', sortname: 'id', viewrecords: true, sortorder: "desc", caption:"Dynamic height/width Example", forceFit : true, onSortCol :function (nm,index) { if (nm=='invdate') { jQuery("#gwidth").jqGrid('setGridParam',{sortname:'name'}); } }, onHeaderClick: function (status){ alert("My status is now: "+ status); } }); jQuery("#gwidth").jqGrid('navGrid','#pgwidth',{edit:false,add:false,del:false}); jQuery("#snw").click(function (){ var nw = parseInt(jQuery("#setwidth").val()); if(isNaN(nw)) { alert("Value must be a number"); } else if (nw<200 || nw > 700) { alert("Value can be between 200 and 700") } else { jQuery("#gwidth").jqGrid('setGridWidth',nw); } }); jQuery("#snh").click(function (){ var nh = jQuery("#setheight").val(); jQuery("#gwidth").jqGrid('setGridHeight',nh); }); </XMP> <b>PHP with MySQL</b> <XMP> ... $page = $_GET['page']; // get the requested page $limit = $_GET['rows']; // get how many rows we want to have into the grid $sidx = $_GET['sidx']; // get index row - i.e. user click to sort $sord = $_GET['sord']; // get the direction if(!$sidx) $sidx =1; // connect to the database $db = mysql_connect($dbhost, $dbuser, $dbpassword) or die("Connection Error: " . mysql_error()); mysql_select_db($database) or die("Error conecting to db."); $result = mysql_query("SELECT COUNT(*) AS count FROM invheader a, clients b WHERE a.client_id=b.client_id"); $row = mysql_fetch_array($result,MYSQL_ASSOC); $count = $row['count']; if( $count >0 ) { $total_pages = ceil($count/$limit); } else { $total_pages = 0; } if ($page > $total_pages) $page=$total_pages; $start = $limit*$page - $limit; // do not put $limit*($page - 1) $SQL = "SELECT a.id, a.invdate, b.name, a.amount,a.tax,a.total,a.note FROM invheader a, clients b WHERE a.client_id=b.client_id ORDER BY $sidx $sord LIMIT $start , $limit"; $result = mysql_query( $SQL ) or die("Couldn t execute query.".mysql_error()); $responce->page = $page; $responce->total = $total_pages; $responce->records = $count; $i=0; while($row = mysql_fetch_array($result,MYSQL_ASSOC)) { $responce->rows[$i]['id']=$row[id]; $responce->rows[$i]['cell']=array($row[id],$row[invdate],$row[name],$row[amount],$row[tax],$row[total],$row[note]); $i++; } echo json_encode($responce); ... </XMP> </div>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/gridwidth.html
HTML
art
4,243
<?php ?>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/someurl.php
PHP
art
11
<div style="font-size:12px;"> This example show two new methods:<br> 1. hideCol(colname) - hide a column with a given colname and <br> 2. showCol(colname) - show a column with a given colname.<br> 3. We can hide a column when the grid is initialized using a new property 'hidden' in colModel<br> Example: {name:'invdate',index:'invdate', width:90, hidden:true} will hide a column Date <br> <b>Known Bugs</b><br> <del>1. In Safari header column does not disappear when hideCol is executed<br></del> <del>2. IE has bad behavior when column is resizable and hideCol is executed. Cursor position of the resizable column does not change. <br> </del> </div> <br /> <table id="list17"></table> <div id="pager17"></div> <br /> <a href="javascript:void(0)" id="hc">Hide column Tax</a><br/> <a href="javascript:void(0)" id="sc">Show column Tax</a> <script src="hideex.js" type="text/javascript"> </script> <br /> <br /> <div style="font-size:12px;"> <b> HTML </b> <XMP> ... <table id="list17"></table> <div id="pager17"></div> <a href="javascript:void(0)" id="hc">Hide column Tax</a><br/> <a href="javascript:void(0)" id="sc">Show column Tax</a> </XMP> <b>Java Scrpt code</b> <XMP> ... jQuery("#list17").jqGrid({ url:'server.php?q=2', datatype: "json", colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',index:'id', width:55}, {name:'invdate',index:'invdate', width:90}, {name:'name',index:'name asc, invdate', 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, rowList:[10,20,30], pager: '#pager17', sortname: 'id', viewrecords: true, sortorder: "desc", caption:"Dynamic hide/show columns" }); jQuery("#list17").jqGrid('navGrid',"#pager17",{edit:false,add:false,del:false}); jQuery("#hc").click( function() { jQuery("#list17").jqGrid('navGrid','hideCol',"tax"); }); jQuery("#sc").click( function() { jQuery("#list17").jqGrid('navGrid','showCol',"tax"); }); </XMP> <b>PHP with MySQL</b> <XMP> ... $page = $_GET['page']; // get the requested page $limit = $_GET['rows']; // get how many rows we want to have into the grid $sidx = $_GET['sidx']; // get index row - i.e. user click to sort $sord = $_GET['sord']; // get the direction if(!$sidx) $sidx =1; // connect to the database $db = mysql_connect($dbhost, $dbuser, $dbpassword) or die("Connection Error: " . mysql_error()); mysql_select_db($database) or die("Error conecting to db."); $result = mysql_query("SELECT COUNT(*) AS count FROM invheader a, clients b WHERE a.client_id=b.client_id"); $row = mysql_fetch_array($result,MYSQL_ASSOC); $count = $row['count']; if( $count >0 ) { $total_pages = ceil($count/$limit); } else { $total_pages = 0; } if ($page > $total_pages) $page=$total_pages; $start = $limit*$page - $limit; // do not put $limit*($page - 1) $SQL = "SELECT a.id, a.invdate, b.name, a.amount,a.tax,a.total,a.note FROM invheader a, clients b WHERE a.client_id=b.client_id ORDER BY $sidx $sord LIMIT $start , $limit"; $result = mysql_query( $SQL ) or die("Couldn t execute query.".mysql_error()); $responce->page = $page; $responce->total = $total_pages; $responce->records = $count; $i=0; while($row = mysql_fetch_array($result,MYSQL_ASSOC)) { $responce->rows[$i]['id']=$row[id]; $responce->rows[$i]['cell']=array($row[id],$row[invdate],$row[name],$row[amount],$row[tax],$row[total],$row[note]); $i++; } echo json_encode($responce); ... </XMP> </div>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/hideex.html
HTML
art
3,794
jQuery("#speed").jqGrid({ url:'bigset.php', datatype: "json", height: 255, width: 600, colNames:['Index','Name', 'Code'], colModel:[ {name:'item_id',index:'item_id', width:65}, {name:'item',index:'item', width:150}, {name:'item_cd',index:'item_cd', width:100} ], rowNum:200, rowList:[100,200,300], mtype: "POST", rownumbers: true, rownumWidth: 40, gridview: true, pager: '#speedp', sortname: 'item_id', viewrecords: true, sortorder: "asc", caption: "Using gridview mode", gridComplete : function() { var tm = jQuery("#speed").jqGrid('getGridParam','totaltime'); $("#speed_div").html("Render time: "+ tm+" ms "); } });
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/speed.js
JavaScript
art
726
<?php // Include the information needed for the connection to // MySQL data base server. include("dbconfig.php"); //since we want to use a JSON data we should include //encoder and decoder for JSON notation //If you use a php >= 5 this file is not needed //include("JSON.php"); // create a JSON service //$json = new Services_JSON(); // to the url parameter are added 4 parameter // we shuld get these parameter to construct the needed query // for the pager // get the requested page $page = $_REQUEST['page']; // get how many rows we want to have into the grid // rowNum parameter in the grid $limit = $_REQUEST['rows']; // get index row - i.e. user click to sort // at first time sortname parameter - after that the index from colModel $sidx = $_REQUEST['sidx']; // sorting order - at first time sortorder $sord = $_REQUEST['sord']; // if we not pass at first time index use the first column for the index if(!$sidx) $sidx =1; // connect to the MySQL database server $db = mysql_connect($dbhost, $dbuser, $dbpassword) or die("Connection Error: " . mysql_error()); // select the database mysql_select_db($database) or die("Error conecting to db."); // calculate the number of rows for the query. We need this to paging the result $result = mysql_query("SELECT COUNT(*) AS count FROM invheader a, clients b WHERE a.client_id=b.client_id"); $row = mysql_fetch_array($result,MYSQL_ASSOC); $count = $row['count']; // calculation of total pages for the query if( $count >0 ) { $total_pages = ceil($count/$limit); } else { $total_pages = 0; } // if for some reasons the requested page is greater than the total // set the requested page to total page if ($page > $total_pages) $page=$total_pages; // calculate the starting position of the rows $start = $limit*$page - $limit; // do not put $limit*($page - 1) // if for some reasons start position is negative set it to 0 // typical case is that the user type 0 for the requested page if($start <0) $start = 0; // the actual query for the grid data $SQL = "SELECT a.id, a.invdate, b.name, a.amount,a.tax,a.total,a.note FROM invheader a, clients b WHERE a.client_id=b.client_id ORDER BY $sidx $sord LIMIT $start , $limit"; $result = mysql_query( $SQL ) or die("Couldn t execute query.".mysql_error()); // constructing a JSON $responce->page = $page; $responce->total = $total_pages; $responce->records = $count; $i=0; while($row = mysql_fetch_array($result,MYSQL_ASSOC)) { $responce->rows[$i]['id']=$row[id]; $responce->rows[$i]['cell']=array($row[id],$row[invdate],$row[name],$row[amount],$row[tax],$row[total],$row[note]); $i++; } // return the formated data //echo $json->encode($responce); echo json_encode($responce); ?>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/example.php
PHP
art
2,773
<div style="font-size:12px;"> This example demonstrates two new fetures in jqGrid <br> 1. loadComplete() callback - this function is executed immediately after data is loaded.<br> This way we can make some changes depending on the needs.<br> 2. New method getDataIDs() - returns the id's of currently loaded data.<br> This method can be used in combination with loadComplete callback. </div> <br /> <table id="list15"></table> <div id="pager15"></div> <a href="javascript:void(0)" id="sids">Get Grid id's</a><br/> <script src="loadcml.js" type="text/javascript"> </script> <br /> <div style="font-size:12px;"> <b> HTML </b> <XMP> ... <table id="list15"></table> <div id="pager15"></div> <a href="javascript:void(0)" id="sids">Get Grid id's</a><br/> </XMP> <b>Java Scrpt code</b> <XMP> ... jQuery("#list15").jqGrid({ url:'server.php?q=2', datatype: "json", colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',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, rowList:[10,20,30], pager: '#pager15', sortname: 'id', viewrecords: true, sortorder: "desc", loadComplete: function(){ var ret; alert("This function is executed immediately after\n data is loaded. We try to update data in row 13."); ret = jQuery("#list15").jqGrid('getRowData',"13"); if(ret.id == "13"){ jQuery("#list15").jqGrid('setRowData',ret.id,{note:"<font color='red'>Row 13 is updated!</font>"}) } } }); jQuery("#sids").click( function() { alert("Id's of Grid: \n"+jQuery("#list15").jqGrid('getDataIDs')); }); </XMP> <b>PHP with MySQL</b> <XMP> ... $page = $_GET['page']; // get the requested page $limit = $_GET['rows']; // get how many rows we want to have into the grid $sidx = $_GET['sidx']; // get index row - i.e. user click to sort $sord = $_GET['sord']; // get the direction if(!$sidx) $sidx =1; // connect to the database $db = mysql_connect($dbhost, $dbuser, $dbpassword) or die("Connection Error: " . mysql_error()); mysql_select_db($database) or die("Error conecting to db."); $result = mysql_query("SELECT COUNT(*) AS count FROM invheader a, clients b WHERE a.client_id=b.client_id"); $row = mysql_fetch_array($result,MYSQL_ASSOC); $count = $row['count']; if( $count >0 ) { $total_pages = ceil($count/$limit); } else { $total_pages = 0; } if ($page > $total_pages) $page=$total_pages; $start = $limit*$page - $limit; // do not put $limit*($page - 1) $SQL = "SELECT a.id, a.invdate, b.name, a.amount,a.tax,a.total,a.note FROM invheader a, clients b WHERE a.client_id=b.client_id ORDER BY $sidx $sord LIMIT $start , $limit"; $result = mysql_query( $SQL ) or die("Couldn t execute query.".mysql_error()); $responce->page = $page; $responce->total = $total_pages; $responce->records = $count; $i=0; while($row = mysql_fetch_array($result,MYSQL_ASSOC)) { $responce->rows[$i]['id']=$row[id]; $responce->rows[$i]['cell']=array($row[id],$row[invdate],$row[name],$row[amount],$row[tax],$row[total],$row[note]); $i++; } echo json_encode($responce); ... </XMP> </div>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/loadcml.html
HTML
art
3,512
jQuery("#grps").jqGrid({ url:'search_adv.php?q=1', datatype: "json", colNames:['Inv No', 'Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id', key : true,index:'a.id',width:55, sorttype:'int'}, {name:'invdate',index:'a.invdate', width:90 }, {name:'name', index:'b.name',width:100}, {name:'amount',index:'a.amount', width:80, align:"right", sorttype:'number'}, {name:'tax',index:'a.tax', width:80, align:"right",sorttype:'number'}, {name:'total',index:'a.total', width:80,align:"right", sorttype:'number'}, {name:'note',index:'a.note', width:150, sortable:false} ], rowNum:10, width:700, rowList:[10,20,30], pager: '#pgrps', sortname: 'invdate', viewrecords: true, sortorder: "desc", caption: "Complex search", height: '100%' }); jQuery("#grps").jqGrid('navGrid','#pgrps', {edit:false,add:false,del:false}, {}, {}, {}, {multipleSearch:true, multipleGroup:true, resize: true, closeOnEscape: true} );
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/40grpsearch.js
JavaScript
art
1,025
jQuery("#48remote").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, sorttype:'int',summaryType:'count', summaryTpl : '({0}) total'}, {name:'invdate',index:'invdate', width:90, sorttype:'date', formatter:'date', datefmt:'d/m/Y'}, {name:'name',index:'name', width:100}, {name:'amount',index:'amount', width:80, align:"right", sorttype:'number',formatter:'number'}, {name:'tax',index:'tax', width:80, align:"right",sorttype:'number',formatter:'number'}, {name:'total',index:'total', width:80,align:"right",sorttype:'number',formatter:'number', summaryType:'sum'}, {name:'note',index:'note', width:150, sortable:false,editable:true} ], rowNum:10, rowList:[10,20,30], height: 'auto', pager: '#p48remote', sortname: 'invdate', viewrecords: true, sortorder: "desc", caption:"Grouping with remote data", grouping: true, groupingView : { groupField : ['name'], groupColumnShow : [true], groupText : ['<b>{0}</b>'], groupCollapse : false, groupOrder: ['asc'], groupSummary : [true], groupDataSorted : true } }); jQuery("#48remote").jqGrid('navGrid','#p48remote',{add:false,edit:false,del:false});
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/38remote1.js
JavaScript
art
1,382
<div> This example shows a typical implementation of jqGrid.<br> You can view this in example.html and example.php files included into demo package. Click on the example link to view the result </div> <br /> <b><a href="http://trirand.com/jqgrid/example.html" target="_blank"> example.html</a> </b> <div style="font-size:12px;"> <XMP> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>jqGrid Demos</title> <!-- In head section we should include the style sheet for the grid --> <link rel="stylesheet" type="text/css" media="screen" href="themes/sand/grid.css" /> <!-- Of course we should load the jquery library --> <script src="js/jquery.js" type="text/javascript"></script> <!-- and at end the jqGrid Java Script file --> <script src="js/jquery.jqGrid.js" type="text/javascript"></script> <script type="text/javascript"> // We use a document ready jquery function. jQuery(document).ready(function(){ jQuery("#list2").jqGrid({ // the url parameter tells from where to get the data from server // adding ?nd='+new Date().getTime() prevent IE caching url:'example.php?nd='+new Date().getTime(), // datatype parameter defines the format of data returned from the server // in this case we use a JSON data datatype: "json", // colNames parameter is a array in which we describe the names // in the columns. This is the text that apper in the head of the grid. colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], // colModel array describes the model of the column. // name is the name of the column, // index is the name passed to the server to sort data // note that we can pass here nubers too. // width is the width of the column // align is the align of the column (default is left) // sortable defines if this column can be sorted (default true) colModel:[ {name:'id',index:'id', width:55}, {name:'invdate',index:'invdate', width:90}, {name:'name',index:'name asc, invdate', 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} ], // pager parameter define that we want to use a pager bar // in this case this must be a valid html element. // note that the pager can have a position where you want pager: jQuery('#pager2'), // rowNum parameter describes how many records we want to // view in the grid. We use this in example.php to return // the needed data. rowNum:10, // rowList parameter construct a select box element in the pager //in wich we can change the number of the visible rows rowList:[10,20,30], // sortname sets the initial sorting column. Can be a name or number. // this parameter is added to the url sortname: 'id', //viewrecords defines the view the total records from the query in the pager //bar. The related tag is: records in xml or json definitions. viewrecords: true, //sets the sorting order. Default is asc. This parameter is added to the url sortorder: "desc", caption: "Demo", }); }); </script> </head> <body> <!-- the grid definition in html is a table tag with class 'scroll' --> <table id="list2"></table> <!-- pager definition. class scroll tels that we want to use the same theme as grid --> <div id="pager2"></div> </body> </html> </XMP> <b>example.php</b> <XMP> <?php // Include the information needed for the connection to // MySQL data base server. include("dbconfig.php"); //since we want to use a JSON data we should include //encoder and decoder for JSON notation //If you use a php >= 5 this file is not needed include("JSON.php"); // create a JSON service $json = new Services_JSON(); // to the url parameter are added 4 parameter // we shuld get these parameter to construct the needed query // // get the requested page $page = $_GET['page']; // get how many rows we want to have into the grid // rowNum parameter in the grid $limit = $_GET['rows']; // get index row - i.e. user click to sort // at first time sortname parameter - after that the index from colModel $sidx = $_GET['sidx']; // sorting order - at first time sortorder $sord = $_GET['sord']; // if we not pass at first time index use the first column for the index if(!$sidx) $sidx =1; // connect to the MySQL database server $db = mysql_connect($dbhost, $dbuser, $dbpassword) or die("Connection Error: " . mysql_error()); // select the database mysql_select_db($database) or die("Error conecting to db."); // calculate the number of rows for the query. We need this to paging the result $result = mysql_query("SELECT COUNT(*) AS count FROM invheader a, clients b WHERE a.client_id=b.client_id"); $row = mysql_fetch_array($result,MYSQL_ASSOC); $count = $row['count']; // calculation of total pages for the query if( $count >0 ) { $total_pages = ceil($count/$limit); } else { $total_pages = 0; } // if for some reasons the requested page is greater than the total // set the requested page to total page if ($page > $total_pages) $page=$total_pages; // calculate the starting position of the rows $start = $limit*$page - $limit; // do not put $limit*($page - 1) // if for some reasons start position is negative set it to 0 // typical case is that the user type 0 for the requested page if($start <0) $start = 0; // the actual query for the grid data $SQL = "SELECT a.id, a.invdate, b.name, a.amount,a.tax,a.total,a.note FROM invheader a, clients b WHERE a.client_id=b.client_id ORDER BY $sidx $sord LIMIT $start , $limit"; $result = mysql_query( $SQL ) or die("Couldn t execute query.".mysql_error()); // constructing a JSON $responce->page = $page; $responce->total = $total_pages; $responce->records = $count; $i=0; while($row = mysql_fetch_array($result,MYSQL_ASSOC)) { $responce->rows[$i]['id']=$row[id]; $responce->rows[$i]['cell']=array($row[id],$row[invdate],$row[name],$row[amount],$row[tax],$row[total],$row[note]); $i++; } // return the formated data echo $json->encode($responce); ?> </XMP> </div>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/demo.html
HTML
art
6,532
jQuery("#pdata").jqGrid({ url:'server.php', datatype: "xml", colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',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, rowList:[10,20,30], pager: '#ppdata', sortname: 'id', mtype: "POST", postData:{q:1}, viewrecords: true, sortorder: "desc", caption:"New Methods", multiselect: true }); jQuery("#pdata").jqGrid('navGrid','#ppdata',{edit:false,add:false,del:false}); jQuery("#ps1").click( function() { $("#pdata").jqGrid('setPostData',{q:1,param1:"p1"}); $("#pdata").trigger("reloadGrid"); }); jQuery("#ps2").click( function() { var pd =$("#pdata").jqGrid('getPostData'); var r =""; $.each(pd,function(i){ r += i+": "+pd[i]+","; }) $("#postdata").html(r).css("background-color","yellow"); }); jQuery("#ps3").click( function() { $("#pdata").jqGrid('appendPostData',{param2:"p2"}); $("#pdata").trigger("reloadGrid"); var pd =$("#pdata").jqGrid('getPostData'); var r =""; $.each(pd,function(i){ r += i+": "+pd[i]+","; }) $("#postdata").html(r).css("background-color","yellow"); }); jQuery("#ps4").click( function() { $("#pdata").jqGrid('setPostDataItem',"param2","I'w new value"); $("#pdata").trigger("reloadGrid"); var pd =$("#pdata").jqGrid('getPostData'); var r =""; $.each(pd,function(i){ r += i+": "+pd[i]+","; }) $("#postdata").html(r).css("background-color","yellow"); }); jQuery("#ps5").click( function() { alert( "rows : "+$("#pdata").jqGrid('getPostDataItem',"rows")); }); jQuery("#ps6").click( function() { $("#pdata").jqGrid('removePostDataItem',"param1"); $("#pdata").trigger("reloadGrid"); var pd =$("#pdata").jqGrid('getPostData'); var r =""; $.each(pd,function(i){ r += i+": "+pd[i]+","; }) $("#postdata").html(r).css("background-color","yellow"); });
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/postdata.js
JavaScript
art
2,239
<div> This example show how we can use The Table Drag and Drop plugin provided from Denis Howlett <br> Try to drag a row whitin table. </div> <br /> <table id="listdnd"></table> <div id="pagerdnd"></div> <script src="tablednd.js" type="text/javascript"> </script> <br /> <b> HTML </b> <XMP> ... <table id="listdnd"></table> <div id="pagerdnd"></div> </XMP> <b>Java Scrpt code</b> <XMP> ... jQuery("#listdnd").tableDnD({scrollAmount:0}); jQuery("#listdnd").jqGrid({ url:'server.php?q=1', datatype: "xml", colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',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, rowList:[10,20,30], pager: '#pagerdnd', sortname: 'id', viewrecords: true, sortorder: "desc", caption:"XML Example", gridComplete: function() { $("#_empty","#listdnd").addClass("nodrag nodrop"); jQuery("#listdnd").tableDnDUpdate(); }, editurl:"someurl.php" }); jQuery("#listdnd").jqGrid('navGrid','#pager1',{edit:false,add:false,del:false}); </XMP> <b>PHP with MySQL</b> <XMP> ... $page = $_GET['page']; // get the requested page $limit = $_GET['rows']; // get how many rows we want to have into the grid $sidx = $_GET['sidx']; // get index row - i.e. user click to sort $sord = $_GET['sord']; // get the direction if(!$sidx) $sidx =1; // connect to the database $db = mysql_connect($dbhost, $dbuser, $dbpassword) or die("Connection Error: " . mysql_error()); mysql_select_db($database) or die("Error conecting to db."); $result = mysql_query("SELECT COUNT(*) AS count FROM invheader a, clients b WHERE a.client_id=b.client_id"); $row = mysql_fetch_array($result,MYSQL_ASSOC); $count = $row['count']; if( $count >0 ) { $total_pages = ceil($count/$limit); } else { $total_pages = 0; } if ($page > $total_pages) $page=$total_pages; $start = $limit*$page - $limit; // do not put $limit*($page - 1) $SQL = "SELECT a.id, a.invdate, b.name, a.amount,a.tax,a.total,a.note FROM invheader a, clients b WHERE a.client_id=b.client_id ORDER BY $sidx $sord LIMIT $start , $limit"; $result = mysql_query( $SQL ) or die("Couldn’t execute query.".mysql_error()); if ( stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml") ) { header("Content-type: application/xhtml+xml;charset=utf-8"); } else { header("Content-type: text/xml;charset=utf-8"); } $et = ">"; echo "<?xml version='1.0' encoding='utf-8'?$et\n"; echo "<rows>"; echo "<page>".$page."</page>"; echo "<total>".$total_pages."</total>"; echo "<records>".$count."</records>"; // be sure to put text data in CDATA while($row = mysql_fetch_array($result,MYSQL_ASSOC)) { echo "<row id='". $row[id]."'>"; echo "<cell>". $row[id]."</cell>"; echo "<cell>". $row[invdate]."</cell>"; echo "<cell><![CDATA[". $row[name]."]]></cell>"; echo "<cell>". $row[amount]."</cell>"; echo "<cell>". $row[tax]."</cell>"; echo "<cell>". $row[total]."</cell>"; echo "<cell><![CDATA[". $row[note]."]]></cell>"; echo "</row>"; } echo "</rows>"; ... </XMP>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/tablednd.html
HTML
art
3,350
jQuery("#sg1").jqGrid({ url:'server.php?q=1', datatype: "xml", height: 190, colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',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:8, rowList:[8,10,20,30], pager: '#psg1', sortname: 'id', viewrecords: true, sortorder: "desc", multiselect: false, subGrid: true, caption: "Custom Icons in Subgrid", // define the icons in subgrid subGridOptions: { "plusicon" : "ui-icon-triangle-1-e", "minusicon" : "ui-icon-triangle-1-s", "openicon" : "ui-icon-arrowreturn-1-e" }, subGridRowExpanded: function(subgrid_id, row_id) { var subgrid_table_id, pager_id; subgrid_table_id = subgrid_id+"_t"; pager_id = "p_"+subgrid_table_id; $("#"+subgrid_id).html("<table id='"+subgrid_table_id+"' class='scroll'></table><div id='"+pager_id+"' class='scroll'></div>"); jQuery("#"+subgrid_table_id).jqGrid({ url:"subgrid.php?q=2&id="+row_id, datatype: "xml", colNames: ['No','Item','Qty','Unit','Line Total'], colModel: [ {name:"num",index:"num",width:80,key:true}, {name:"item",index:"item",width:130}, {name:"qty",index:"qty",width:70,align:"right"}, {name:"unit",index:"unit",width:70,align:"right"}, {name:"total",index:"total",width:70,align:"right",sortable:false} ], rowNum:20, pager: pager_id, sortname: 'num', sortorder: "asc", height: '100%' }); jQuery("#"+subgrid_table_id).jqGrid('navGrid',"#"+pager_id,{edit:false,add:false,del:false}) } }); jQuery("#sg1").jqGrid('navGrid','#psg1',{add:false,edit:false,del:false});
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/40subgrid1.js
JavaScript
art
2,027
jQuery("#addgrid").jqGrid({ url:'editing.php?q=1', datatype: "xml", 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: '#pagerad', sortname: 'id', viewrecords: true, sortorder: "desc", caption:"Adding data Example", editurl:"someurl.php" }); $("#badata").click(function(){ jQuery("#addgrid").jqGrid('editGridRow',"new",{height:280,reloadAfterSubmit:false}); });
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/adding.js
JavaScript
art
1,449
<link rel="stylesheet" type="text/css" media="screen" href="themes/redmond/jquery-ui-1.8.2.custom.css" /> <link rel="stylesheet" type="text/css" media="screen" href="themes/ui.jqgrid.css" /> <link rel="stylesheet" type="text/css" media="screen" href="themes/ui.multiselect.css" /> <script src="js/jquery.min.js" type="text/javascript"></script> <script src="js/i18n/grid.locale-en.js" type="text/javascript"></script> <script src="js/jquery.jqGrid.min.js" type="text/javascript"></script> <script src="js/jquery.contextmenu.js" type="text/javascript"></script> <script src="js/jquery.layout.js" type="text/javascript"></script> <script src="js/jquery.tablednd.js" type="text/javascript"></script> <div style="font-size:12px;"> Thanks to Mark Williams we have another great feature - Column Reordering.<br> This is done again just with setting one options - sortable. Click on header column and try to move it to another location.<br> This feature depend on jQuery UI sortable widget.<br> Since we have other great stuffs which are depend on jQuery UI we have created a separated module<br> grid.jqueryui.js <br /> <table id="colr"></table> <div id="pcolr"></div> <script src="36colreorder.js" type="text/javascript"> </script> <br /> <div style="font-size:12px;"> <b> HTML </b> <XMP> <table id="colr"></table> <div id="pcolr"></div> </XMP> <b>Java Scrpt code</b> <XMP> jQuery("#colr").jqGrid({ sortable: true, url:'server.php?q=2', datatype: "json", colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',index:'id', width:55}, {name:'invdate',index:'invdate', width:90}, {name:'name',index:'name asc, invdate', 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, rowList:[10,20,30], pager: '#pcolr', sortname: 'invdate', viewrecords: true, sortorder: "desc", caption:"Column Reordering Example" }); jQuery("#colr").jqGrid('navGrid','#pcolr',{add:false,edit:false,del:false}); </XMP> </div>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/36colreorder.html
HTML
art
2,275
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>jqGrid Demos</title> <style> html, body { margin: 0; /* Remove body margin/padding */ padding: 0; overflow: hidden; /* Remove scroll bars on browser window */ font: 12px "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana; } /*Splitter style */ #Splitter { /* min-width: 600px;*/ /* Splitter can't be too thin ... */ min-height: 300px; /* ... or too flat */ margin: .1em .1em .1em .1em; border: 4px solid #83B4D8; /* No padding allowed */ } #LeftPane { width: 200px; /* optional, initial splitbar position */ min-width: 50px; /* optional */ max-width: 350px; background: #F8F8FF; padding: 2px; overflow: hidden; white-space: nowrap; } /* * Right-side element of the splitter. */ #RightPane { background: #F8F8FF; padding: 2px; overflow: auto; width:700px; min-width: 500px; } /* * Splitter bar style; the .active class is added when the * mouse is over the splitter or the splitter is focused * via the keyboard taborder or an accessKey. */ #Splitter .vsplitbar { width: 4px; background: #83B4D8 url(images/vgrabber.gif) no-repeat center; } #Splitter .vsplitbar.active, #Splitter .vsplitbar:hover { background: #c66 url(images/vgrabber.gif) no-repeat center; } </style> <link rel="stylesheet" type="text/css" media="screen" href="themes/tree.css" /> <link rel="stylesheet" type="text/css" media="screen" href="themes/tabs.css" /> <link rel="stylesheet" type="text/css" media="screen" href="themes/grid.css" /> <link rel="stylesheet" type="text/css" media="screen" href="themes/modal.css" /> <link rel="stylesheet" type="text/css" media="screen" href="themes/searchdb.css" /> <link rel="stylesheet" type="text/css" media="screen" href="themes/ui.datepicker.css" /> <script src="js/jquery.js" type="text/javascript"></script> <script src="js/jquery.dimensions.js" type="text/javascript"></script> <script src="js/jquery.splitter.js" type="text/javascript"></script> <script src="js/jquery.jqTree.js" type="text/javascript"></script> <script src="js/jquery.jqDynTabs.js" type="text/javascript"></script> <script src="js/ui.datepicker.js" type="text/javascript"></script> <script src="js/grid.js" type="text/javascript"></script> <script src="js/grid.editing.js" type="text/javascript"></script> <script src="js/grid.subgrid.js" type="text/javascript"></script> <script type="text/javascript"> // searchdb translation jQuery(document).ready(function(){ jQuery("#Splitter").splitter({ type: 'v', initA: 200, maxA: 350, minA:30, accessKey: '|' }); // Firefox doesn't fire resize on page elements jQuery(window).bind("resize", function(){ var $ms = $("#Splitter"); var top = $ms.offset().top; // from dimensions.js var wh = $(window).height(); // Account for margin or border on the splitter container var mrg = parseInt($ms.css("marginBottom")) || 0; var brd = parseInt($ms.css("borderBottomWidth")) || 0; $ms.css("height", (wh-top-mrg-brd-3)+"px"); // IE fires resize for splitter; others don't so do it here if ( !jQuery.browser.msie ) $ms.trigger("resize"); }).trigger("resize"); $("#LeftPane").jqTree('tree.xml', {saveNodesStateInCookies : false, imgpath:'images/', onSelectNode: function( id, title, isLeaf ) { if( isLeaf ) { if (!maintab.tabExists(title) ) { if( maintab.getTabIndex() >= 5) // maximum 5 tabs open maintab.TabCloseEl(0); maintab.CreateTab(title,true,id) } } } }); var maintab = $("#RightPane").jqDynTabs({tabcontrol:$("#mainTabArea"), tabcontent :$("#mainPanelArea"), position:"top"}); }); </script> </head> <body> <div id="Splitter"> <div id="LeftPane"> </div> <!-- #LeftPane --> <div id="RightPane"> <table class="tabHolder" cellspacing="0" cellpadding="0" onselectstart="return false;"> <tr id="mainTabArea"> <td style="font-size:1px;border-bottom:3px solid #83B4D8; width:100% " align="right"> &nbsp;</td> </tr> </table> <!-- Tabs pane --> <div id="mainPanelArea" class="tabPanel" ></div> </div> <!-- #RightPane --> </div> <!-- #Splitter --> </div> </body> </html>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/refactor.html
HTML
art
4,760
jQuery("#rowed2").jqGrid({ url:'server.php?q=3', datatype: "json", colNames:['Actions','Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'act',index:'act', width:75,sortable:false}, {name:'id',index:'id', width:55}, {name:'invdate',index:'invdate', width:90, editable:true}, {name:'name',index:'name', width:100,editable:true}, {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} ], rowNum:10, rowList:[10,20,30], pager: '#prowed2', sortname: 'id', viewrecords: true, sortorder: "desc", gridComplete: function(){ var ids = jQuery("#rowed2").jqGrid('getDataIDs'); for(var i=0;i<ids.length;i++){ var cl = ids[i]; be = "<input style='height:22px;width:20px;' type='button' value='E' onclick=\"jQuery('#rowed2').jqGrid('editRow','"+cl+"');\" />"; se = "<input style='height:22px;width:20px;' type='button' value='S' onclick=\"jQuery('#rowed2').jqGrid('saveRow','"+cl+"');\" />"; ce = "<input style='height:22px;width:20px;' type='button' value='C' onclick=\"jQuery('#rowed2').jqGrid('restoreRow','"+cl+"');\" />"; jQuery("#rowed2").jqGrid('setRowData',ids[i],{act:be+se+ce}); } }, editurl: "server.php", caption:"Custom edit " }); jQuery("#rowed2").jqGrid('navGrid',"#prowed2",{edit:false,add:false,del:false});
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/rowedex2.js
JavaScript
art
1,607
<div style="font-size:12px;"> This example show the new Cell editing feature of jqGrid. Select some cell. <br> The fields date, amout and tax are editable. When select a cell you can <br> navigate with left, right, up and down keys. The Enter key save the content. The esc does not save the content.<br> Try to change the values of amount or tax and see that the total changes.<br> To enable cell editing you should just set cellEdit: true and ajust the colModel in appropriate way. </div> <br /> <table id="celltbl"></table> <div id="pcelltbl"></div> <script src="celledit.js" type="text/javascript"> </script> <br /> <div style="font-size:12px;"> <b> HTML </b> <XMP> ... <table id="celltbl"></table> <div id="pcelltbl"></div> <script src="celledit.js" type="text/javascript"> </script> </XMP> <b>Java Scrpt code</b> <XMP> ... jQuery("#celltbl").jqGrid({ url:'server.php?q=2', datatype: "json", colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',index:'id', width:55}, {name:'invdate',index:'invdate', width:90,editable:true}, {name:'name',index:'name asc, invdate', width:100}, {name:'amount',index:'amount', width:80, align:"right",editable:true,editrules:{number:true}}, {name:'tax',index:'tax', width:80, align:"right",editable:true,editrules:{number:true}}, {name:'total',index:'total', width:80,align:"right"}, {name:'note',index:'note', width:150, sortable:false} ], rowNum:10, rowList:[10,20,30], pager: '#pcelltbl', sortname: 'id', viewrecords: true, sortorder: "desc", caption:"Cell Edit Example", forceFit : true, cellEdit: true, cellsubmit: 'clientArray', afterEditCell: function (id,name,val,iRow,iCol){ if(name=='invdate') { jQuery("#"+iRow+"_invdate","#celltbl").datepicker({dateFormat:"yy-mm-dd"}); } }, afterSaveCell : function(rowid,name,val,iRow,iCol) { if(name == 'amount') { var taxval = jQuery("#celltbl").jqGrid('getCell',rowid,iCol+1); jQuery("#celltbl").jqGrid('setRowData',rowid,{total:parseFloat(val)+parseFloat(taxval)}); } if(name == 'tax') { var amtval = jQuery("#celltbl").jqGrid('getCell',rowid,iCol-1); jQuery("#celltbl").jqGrid('setRowData',rowid,{total:parseFloat(val)+parseFloat(amtval)}); } } }); jQuery("#celltbl").jqGrid('navGrid','#pgwidth',{edit:false,add:false,del:false}); </XMP> <b>PHP with MySQL</b> <XMP> ... $page = $_GET['page']; // get the requested page $limit = $_GET['rows']; // get how many rows we want to have into the grid $sidx = $_GET['sidx']; // get index row - i.e. user click to sort $sord = $_GET['sord']; // get the direction if(!$sidx) $sidx =1; // connect to the database $db = mysql_connect($dbhost, $dbuser, $dbpassword) or die("Connection Error: " . mysql_error()); mysql_select_db($database) or die("Error conecting to db."); $result = mysql_query("SELECT COUNT(*) AS count FROM invheader a, clients b WHERE a.client_id=b.client_id"); $row = mysql_fetch_array($result,MYSQL_ASSOC); $count = $row['count']; if( $count >0 ) { $total_pages = ceil($count/$limit); } else { $total_pages = 0; } if ($page > $total_pages) $page=$total_pages; $start = $limit*$page - $limit; // do not put $limit*($page - 1) $SQL = "SELECT a.id, a.invdate, b.name, a.amount,a.tax,a.total,a.note FROM invheader a, clients b WHERE a.client_id=b.client_id ORDER BY $sidx $sord LIMIT $start , $limit"; $result = mysql_query( $SQL ) or die("Couldn t execute query.".mysql_error()); $responce->page = $page; $responce->total = $total_pages; $responce->records = $count; $i=0; while($row = mysql_fetch_array($result,MYSQL_ASSOC)) { $responce->rows[$i]['id']=$row[id]; $responce->rows[$i]['cell']=array($row[id],$row[invdate],$row[name],$row[amount],$row[tax],$row[total],$row[note]); $i++; } echo json_encode($responce); ... </XMP> </div>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/celledit.html
HTML
art
3,980
<div style="font-size:12px;"> This example demonstartes new methods. Try to click on pager buttons. </div> <b>Response:</b> <span id="resp"></span> <br/> <br/> <table id="method"></table> <div id="pmethod"></div> <br /> <a href="javascript:void(0)" id="sm1">Get number of record</a> <br /> <a href="javascript:void(0)" id="sm2">Set a onSelectRow Method</a> <br /> <a href="javascript:void(0)" id="sm3" >Reset selected Rows</a> <span> << Select some rows and then click me </span> <script src="methods.js" type="text/javascript"> </script> <br /> <br /> <div style="font-size:12px;"> <b> HTML </b> <XMP> ... <b>Response:</b> <span id="resp"></span> <br/> <br/> <table id="method"></table> <div id="pmethod"></div> <br /> <a href="javascript:void(0)" id="sm1">Get number of record</a> <br /> <a href="javascript:void(0)" id="sm2">Set a onSelectRow Method</a> <br /> <a href="javascript:void(0)" id="sm3" >Reset selected Rows</a> <span> << Select some rows and then click me </span> <script src="methods.js" type="text/javascript"> </script> </XMP> <b>Java Scrpt code</b> <XMP> ... jQuery("#method").jqGrid({ url:'server.php?q=1', datatype: "xml", colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',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, rowList:[10,20,30], pager: '#pmethod', sortname: 'id', viewrecords: true, sortorder: "desc", caption:"New Methods", multiselect: true, onPaging : function(but) { alert("Button: "+but + " is clicked"); } }); jQuery("#method").jqGrid('navGrid','#pmethod',{edit:false,add:false,del:false}); jQuery("#sm1").click( function() { alert($("#method").jqGrid('getGridParam',"records")); }); jQuery("#sm2").click( function() { $("#method").jqGrid('setGridParam',{ onSelectRow : function(id) { $("#resp").html("I'm row number: "+id +" and setted dynamically").css("color","red"); } }); alert("Try to select row"); }); jQuery("#sm3").click( function() { $("#method").jqGrid('resetSelection'); }); </XMP> <b>PHP with MySQL</b> <XMP> ... $page = $_GET['page']; // get the requested page $limit = $_GET['rows']; // get how many rows we want to have into the grid $sidx = $_GET['sidx']; // get index row - i.e. user click to sort $sord = $_GET['sord']; // get the direction if(!$sidx) $sidx =1; // connect to the database $db = mysql_connect($dbhost, $dbuser, $dbpassword) or die("Connection Error: " . mysql_error()); mysql_select_db($database) or die("Error conecting to db."); $result = mysql_query("SELECT COUNT(*) AS count FROM invheader a, clients b WHERE a.client_id=b.client_id"); $row = mysql_fetch_array($result,MYSQL_ASSOC); $count = $row['count']; if( $count >0 ) { $total_pages = ceil($count/$limit); } else { $total_pages = 0; } if ($page > $total_pages) $page=$total_pages; $start = $limit*$page - $limit; // do not put $limit*($page - 1) $SQL = "SELECT a.id, a.invdate, b.name, a.amount,a.tax,a.total,a.note FROM invheader a, clients b WHERE a.client_id=b.client_id ORDER BY $sidx $sord LIMIT $start , $limit"; $result = mysql_query( $SQL ) or die("Couldn’t execute query.".mysql_error()); if ( stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml") ) { header("Content-type: application/xhtml+xml;charset=utf-8"); } else { header("Content-type: text/xml;charset=utf-8"); } $et = ">"; echo "<?xml version='1.0' encoding='utf-8'?$et\n"; echo "<rows>"; echo "<page>".$page."</page>"; echo "<total>".$total_pages."</total>"; echo "<records>".$count."</records>"; // be sure to put text data in CDATA while($row = mysql_fetch_array($result,MYSQL_ASSOC)) { echo "<row id='". $row[id]."'>"; echo "<cell>". $row[id]."</cell>"; echo "<cell>". $row[invdate]."</cell>"; echo "<cell><![CDATA[". $row[name]."]]></cell>"; echo "<cell>". $row[amount]."</cell>"; echo "<cell>". $row[tax]."</cell>"; echo "<cell>". $row[total]."</cell>"; echo "<cell><![CDATA[". $row[note]."]]></cell>"; echo "</row>"; } echo "</rows>"; ... </XMP> </div>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/methods.html
HTML
art
4,477
<div style="font-size:12px;"> This example show how we can add dialog for live data search.<br/> See below for all available options. <br/> </div> <br /> <table id="search"></table> <div id="pagersr"></div> <input type="BUTTON" id="bsdata" value="Search" /> <script src="searching.js" type="text/javascript"> </script> <br /><br /> <div style="font-size:12px;"> <b> Description </b> <br /> This method uses <b>colModel</b> names and <b>url</b> parameters from jqGrid <br/> <code> Calling: jQuery("#grid_id").searchGrid( options ); </code> <br/> <b> options </b> <br/> <b>top : 0</b> the initial top position of search dialog<br/> <b>left: 0</b> the initinal left position of search dialog<br/> If the left and top positions are not set the dialog apper on<br/> upper left corner of the grid <br/> <b>width: 360</b>, the width of serch dialog - default 360<br/> <b>height: 70</b>, the height of serch dialog default 70<br/> <b>modal: false</b>, determine if the dialog should be in modal mode default is false<br/> <b>drag: true</b>,determine if the dialog is dragable default true<br/> <b>caption: "Search..."</b>,the caption of the dialog<br/> <b>Find: "Find"</b>, the text of the button when you click to search data default Find<br/> <b>Reset: "Reset"</b>,the text of the button when you click to clear search string default Reset<br/> <b>dirty: false</b>, applicable only in navigator see the last example<br/> These parameters are passed to the url <br/> <b>sField:'searchField'</b>, is the name that is passed to url the value is the name from colModel<br/> <b>sValue:'searchString'</b>,is the name that is passed to url the value is the entered value<br/> <b>sOper: 'searchOper'</b>, is the name that is passed to the url the value is the type of search - see sopt array<br/> // translation string for the search options<br/> <b>odata : ['equal', 'not equal', 'less', 'less or equal','greater','greater or equal', 'begins with','ends with','contains' ]</b>,<br/> // if you want to change or remove the order change it in sopt<br/> <b>sopt: null // ['bw','eq','ne','lt','le','gt','ge','ew','cn']</b> <br/> by default all options are allowed. The codes are as follow:<br/> bw - begins with ( LIKE val% )<br/> eq - equal ( = )<br/> ne - not equal ( <> )<br/> lt - little ( < )<br/> le - little or equal ( <= )<br/> gt - greater ( > )<br/> ge - greater or equal ( >= )<br/> ew - ends with (LIKE %val )<br/> cn - contain (LIKE %val% )<br/> <b> HTML </b> <XMP> ... <table id="search"></table> <div id="pagersr"></div> <input type="BUTTON" id="bsdata" value="Search" /> </XMP> <b>Java Scrpt code</b> <XMP> ... jQuery("#search").jqGrid({ url:'server.php?q=1', datatype: "xml", colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',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, rowList:[10,20,30], pager: '#pagersr', sortname: 'id', viewrecords: true, sortorder: "desc", caption:"Search Example", editurl:"someurl.php" }); $("#bsdata").click(function(){ jQuery("#search").jqGrid('searchGrid', {sopt:['cn','bw','eq','ne','lt','gt','ew']} ); }); </XMP> <b>PHP with MySQL</b> <XMP> ... $page = $_GET['page']; // get the requested page $limit = $_GET['rows']; // get how many rows we want to have into the grid $sidx = $_GET['sidx']; // get index row - i.e. user click to sort $sord = $_GET['sord']; // get the direction if(!$sidx) $sidx =1; // connect to the database $db = mysql_connect($dbhost, $dbuser, $dbpassword) or die("Connection Error: " . mysql_error()); mysql_select_db($database) or die("Error conecting to db."); $result = mysql_query("SELECT COUNT(*) AS count FROM invheader a, clients b WHERE a.client_id=b.client_id"); $row = mysql_fetch_array($result,MYSQL_ASSOC); $count = $row['count']; if( $count >0 ) { $total_pages = ceil($count/$limit); } else { $total_pages = 0; } if ($page > $total_pages) $page=$total_pages; $start = $limit*$page - $limit; // do not put $limit*($page - 1) $SQL = "SELECT a.id, a.invdate, b.name, a.amount,a.tax,a.total,a.note FROM invheader a, clients b WHERE a.client_id=b.client_id ORDER BY $sidx $sord LIMIT $start , $limit"; $result = mysql_query( $SQL ) or die("Couldn’t execute query.".mysql_error()); if ( stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml") ) { header("Content-type: application/xhtml+xml;charset=utf-8"); } else { header("Content-type: text/xml;charset=utf-8"); } $et = ">"; echo "<?xml version='1.0' encoding='utf-8'?$et\n"; echo "<rows>"; echo "<page>".$page."</page>"; echo "<total>".$total_pages."</total>"; echo "<records>".$count."</records>"; // be sure to put text data in CDATA while($row = mysql_fetch_array($result,MYSQL_ASSOC)) { echo "<row id='". $row[id]."'>"; echo "<cell>". $row[id]."</cell>"; echo "<cell>". $row[invdate]."</cell>"; echo "<cell><![CDATA[". $row[name]."]]></cell>"; echo "<cell>". $row[amount]."</cell>"; echo "<cell>". $row[tax]."</cell>"; echo "<cell>". $row[total]."</cell>"; echo "<cell><![CDATA[". $row[note]."]]></cell>"; echo "</row>"; } echo "</rows>"; ... </XMP> </div>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/searching.html
HTML
art
5,600
<div style="font-size:12px;"> We can export the grid data to XML and JSON format. </div> <br /> <table id="list8"></table> <div id="pager8"></div> <br /> <a href="javascript:void(0)" id="e1">View data as xml</a> <br /> <a href="javascript:void(0)" id="e2">View data as json</a> <script src="exportex.js" type="text/javascript"> </script> <br /> <br /> <div style="font-size:12px;"> <b> HTML </b> <XMP> ... <table id="list8"></table> <div id="pager8"></div> <br /> <a href="javascript:void(0)" id="e1">View data as xml</a> <br /> <a href="javascript:void(0)" id="e2">View data as json</a> </XMP> <b>Java Scrpt code</b> <XMP> ... jQuery("#list8").jqGrid({ url:'server.php?q=2&nd='+new Date().getTime(), datatype: "json", colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',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, rowList:[10,20,30], pager: jQuery('#pager8'), sortname: 'id', viewrecords: true, sortorder: "desc" }); jQuery("#e1").click( function() { var s; s = jQuery("#list8").toXmlData(); alert(s); }); jQuery("#e2").click( function() { var s; s = jQuery("#list8").toJSONData(); alert(s); }); </XMP> <b>PHP with MySQL</b> <XMP> ... $page = $_GET['page']; // get the requested page $limit = $_GET['rows']; // get how many rows we want to have into the grid $sidx = $_GET['sidx']; // get index row - i.e. user click to sort $sord = $_GET['sord']; // get the direction if(!$sidx) $sidx =1; // connect to the database $db = mysql_connect($dbhost, $dbuser, $dbpassword) or die("Connection Error: " . mysql_error()); mysql_select_db($database) or die("Error conecting to db."); $result = mysql_query("SELECT COUNT(*) AS count FROM invheader a, clients b WHERE a.client_id=b.client_id"); $row = mysql_fetch_array($result,MYSQL_ASSOC); $count = $row['count']; if( $count >0 ) { $total_pages = ceil($count/$limit); } else { $total_pages = 0; } if ($page > $total_pages) $page=$total_pages; $start = $limit*$page - $limit; // do not put $limit*($page - 1) $SQL = "SELECT a.id, a.invdate, b.name, a.amount,a.tax,a.total,a.note FROM invheader a, clients b WHERE a.client_id=b.client_id ORDER BY $sidx $sord LIMIT $start , $limit"; $result = mysql_query( $SQL ) or die("Couldn t execute query.".mysql_error()); $responce->page = $page; $responce->total = $total_pages; $responce->records = $count; $i=0; while($row = mysql_fetch_array($result,MYSQL_ASSOC)) { $responce->rows[$i]['id']=$row[id]; $responce->rows[$i]['cell']=array($row[id],$row[invdate],$row[name],$row[amount],$row[tax],$row[total],$row[note]); $i++; } echo json_encode($responce); ... </XMP> </div>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/exportex.html
HTML
art
3,116
<link rel="stylesheet" type="text/css" media="screen" href="themes/redmond/jquery-ui-1.8.2.custom.css" /> <link rel="stylesheet" type="text/css" media="screen" href="themes/ui.jqgrid.css" /> <link rel="stylesheet" type="text/css" media="screen" href="themes/ui.multiselect.css" /> <script src="js/jquery.min.js" type="text/javascript"></script> <script src="js/i18n/grid.locale-en.js" type="text/javascript"></script> <script src="js/jquery.jqGrid.min.js" type="text/javascript"></script> <script src="js/jquery.contextmenu.js" type="text/javascript"></script> <script src="js/jquery.layout.js" type="text/javascript"></script> <script src="js/jquery.tablednd.js" type="text/javascript"></script> <div style="font-size:12px;"> We can search on multiple fields too (local seraching) <br> <br> </div> <br /> <table id="multiple37"></table> <div id="pmultiple37" ></div> <script src="37multiple.js" type="text/javascript"> </script> <br /> <div style="font-size:12px;"> <b> HTML </b> <XMP> ... <table id="multiple37"></table> <div id="pmultiple37" ></div> </XMP> <b>Java Scrpt code</b> <XMP> ... jQuery("#multiple37").jqGrid({ url:'localset.php', datatype: "json", height: 255, width: 600, colNames:['Index','Name', 'Code'], colModel:[ {name:'item_id',index:'item_id', width:65, sorttype:'int'}, {name:'item',index:'item', width:150}, {name:'item_cd',index:'item_cd', width:100} ], rowNum:50, rowTotal: 2000, rowList : [20,30,50], loadonce:true, mtype: "GET", rownumbers: true, rownumWidth: 40, gridview: true, pager: '#pmultiple37', sortname: 'item_id', viewrecords: true, sortorder: "asc", caption: "Multiple search on local Data" }); jQuery("#multiple37").jqGrid('navGrid','#pmultiple37',{del:false,add:false,edit:false},{},{},{},{multipleSearch:true}); </XMP> <b>PHP with MySQL</b> <XMP> ... $page = $_REQUEST['page']; // get the requested page $limit = $_REQUEST['rows']; // get how many rows we want to have into the grid $sidx = $_REQUEST['sidx']; // get index row - i.e. user click to sort $sord = $_REQUEST['sord']; // get the direction if(!$sidx) $sidx =1; $totalrows = isset($_REQUEST['totalrows']) ? $_REQUEST['totalrows']: false; if($totalrows) { $limit = $totalrows; } // connect to the database $db = mysql_pconnect($dbhost, $dbuser, $dbpassword) or die("Connection Error: " . mysql_error()); mysql_select_db($database) or die("Error conecting to db."); //populateDBRandom(); $result = mysql_query("SELECT COUNT(*) AS count FROM items"); $row = mysql_fetch_array($result,MYSQL_ASSOC); $count = $row['count']; if( $count >0 ) { $total_pages = ceil($count/$limit); } else { $total_pages = 0; } if ($page > $total_pages) $page=$total_pages; if ($limit<0) $limit = 0; $start = $limit*$page - $limit; // do not put $limit*($page - 1) if ($start<0) $start = 0; $SQL = "SELECT item_id, item, item_cd FROM items ".$where." ORDER BY $sidx $sord LIMIT $start , $limit"; $result = mysql_query( $SQL ) or die("Couldn�t execute query.".mysql_error()); $responce->page = $page; $responce->total = $total_pages; $responce->records = $count; $i=0; while($row = mysql_fetch_array($result,MYSQL_ASSOC)) { $responce->rows[$i]['id']=$row[item_id]; $responce->rows[$i]['cell']=array($row[item_id],$row[item],$row[item_cd]); $i++; } echo json_encode($responce); mysql_close($db); ... </XMP> </div>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/37multiple.html
HTML
art
3,494
jQuery("#search").jqGrid({ url:'server.php?q=1', datatype: "xml", colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',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, rowList:[10,20,30], pager: '#pagersr', sortname: 'id', viewrecords: true, sortorder: "desc", caption:"Search Example", editurl:"someurl.php" }); $("#bsdata").click(function(){ jQuery("#search").jqGrid('searchGrid', {sopt:['cn','bw','eq','ne','lt','gt','ew']} ); });
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/searching.js
JavaScript
art
887
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"}, {id:"6",invdate:"2007-09-06",name:"test3",note:"note3",tax:"30.00",total:"430.00"}, {id:"7",invdate:"2007-10-04",name:"test",note:"note",tax:"10.00",total:"210.00"}, {id:"8",invdate:"2007-10-03",name:"test2",note:"note2",amount:"300.00",tax:"21.00",total:"320.00"}, {id:"9",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}, {id:"11",invdate:"2007-10-01",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"}, {id:"12",invdate:"2007-10-02",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"}, {id:"13",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}, {id:"14",invdate:"2007-10-04",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"}, {id:"15",invdate:"2007-10-05",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"}, {id:"16",invdate:"2007-09-06",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}, {id:"17",invdate:"2007-10-04",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"}, {id:"18",invdate:"2007-10-03",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"}, {id:"19",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}, {id:"21",invdate:"2007-10-01",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"}, {id:"22",invdate:"2007-10-02",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"}, {id:"23",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}, {id:"24",invdate:"2007-10-04",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"}, {id:"25",invdate:"2007-10-05",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"}, {id:"26",invdate:"2007-09-06",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}, {id:"27",invdate:"2007-10-04",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"}, {id:"28",invdate:"2007-10-03",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"}, {id:"29",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"} ]; jQuery("#list48").jqGrid({ data: mydata, datatype: "local", height: 'auto', rowNum: 30, rowList: [10,20,30], colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','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, editable:true}, {name:'amount',index:'amount', width:80, align:"right",sorttype:"float", formatter:"number", editable:true}, {name:'tax',index:'tax', width:80, align:"right",sorttype:"float", editable:true}, {name:'total',index:'total', width:80,align:"right",sorttype:"float"}, {name:'note',index:'note', width:150, sortable:false} ], pager: "#plist48", viewrecords: true, sortname: 'name', grouping:true, groupingView : { groupField : ['name'] }, caption: "Grouping Array Data" });
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/38array.js
JavaScript
art
3,648
jQuery("#ainsrow").jqGrid({ url:'server.php?q=1', datatype: "xml", colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',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, rowList:[10,20,30], pager: '#painsrow', sortname: 'id', viewrecords: true, sortorder: "desc", caption:"After insert row event", multiselect: true, afterInsertRow: function(rowid, aData){ switch (aData.name) { case 'Client 1': jQuery("#ainsrow").jqGrid('setCell',rowid,'total','',{color:'green'}); break; case 'Client 2': jQuery("#ainsrow").jqGrid('setCell',rowid,'total','',{color:'red'}); break; case 'Client 3': jQuery("#ainsrow").jqGrid('setCell',rowid,'total','',{color:'blue'}); break; } } }); jQuery("#ainsrow").jqGrid('navGrid','#painsrow',{edit:false,add:false,del:false});
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/afterinsrow.js
JavaScript
art
1,294
jQuery("#colspan").jqGrid({ url:'server.php?q=4', datatype: "json", colNames:['Date', 'Inv No', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'invdate',index:'invdate', width:90}, { name:'id', key : true, index:'id', width:55, cellattr: function(rowId, value, rowObject, colModel, arrData) { return ' colspan=2'; }, formatter : function(value, options, rData){ return "Invoce: "+value + " - "+rData['name']; } }, {name:'name', index:'name', width:100, cellattr: function(rowId, value, rowObject, colModel, arrData) { return " style=display:none; "; } }, {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: '#pcolspan', sortname: 'invdate', viewrecords: true, sortorder: "desc", jsonReader: { repeatitems : false }, caption: "Data colspan", height: '100%' }); jQuery("#colspan").jqGrid('navGrid','#pcolspan',{edit:false,add:false,del:false});
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/40colspan.js
JavaScript
art
1,252
<%@ page language="java" import="java.util.*" contentType="text/html; charset=utf-8" pageEncoding="GBK"%> <% String examp = request.getParameter("q"); System.out.println(examp); %> { "page":"1", "total":"2", "records":"12", "rows":[ <% if(examp==null||"1".equals(examp)){ %> {"id":"0","cell":["id0","invdate", "name", "amount","tax","total","note"]}, {"id":"1","cell":["id1","invdate", "name", "amount","tax","total","note"]}, {"id":"2","cell":["id2","invdate", "name", "amount","tax","total","note"]}, {"id":"3","cell":["id3","invdate", "name", "amount","tax","total","note"]}, {"id":"4","cell":["id4","invdate", "name", "amount","tax","total","note"]}, {"id":"5","cell":["id5","invdate", "name", "amount","tax","total","note"]}, {"id":"6","cell":["id6","invdate", "name", "amount","tax","total","note"]}, {"id":"7","cell":["id7","invdate", "name", "amount","tax","total","note"]}, {"id":"8","cell":["id8","invdate", "name", "amount","tax","total","note"]}, {"id":"9","cell":["id9","invdate", "name", "amount","tax","total","note"]}, {"id":"10","cell":["id10","invdate", "name", "amount","tax","total","note"]} <% }else{ %> {"id":"0","cell":["id0","invdate", "name", "amount","tax","total","note"]}, {"id":"1","cell":["id1","invdate", "name", "amount","tax","total","note"]}, {"id":"2","cell":["id2","invdate", "name", "amount","tax","total","note"]}, {"id":"3","cell":["id3","invdate", "name", "amount","tax","total","note"]}, {"id":"4","cell":["id4","invdate", "name", "amount","tax","total","note"]}, {"id":"5","cell":["id5","invdate", "name", "amount","tax","total","note"]}, {"id":"6","cell":["id6","invdate", "name", "amount","tax","total","note"]}, {"id":"7","cell":["id7","invdate", "name", "amount","tax","total","note"]}, {"id":"8","cell":["id8","invdate", "name", "amount","tax","total","note"]}, {"id":"9","cell":["id9","invdate", "name", "amount","tax","total","note"]}, {"id":"10","cell":["id10","invdate", "name", "amount","tax","total","note"]}, {"id":"11","cell":["id11","invdate", "name", "amount","tax","total","note"]} <% } %> ] }
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/server.jsp
Java Server Pages
art
2,124
jQuery("#frmac").jqGrid({ url:'server.php?q=4', datatype: "json", colNames:[' ', 'Inv No', 'Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name: 'myac', width:80, fixed:true, sortable:false, resize:false, formatter:'actions', formatoptions:{keys:true}}, {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", 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} ], rowNum:10, width:700, rowList:[10,20,30], pager: '#pfrmac', sortname: 'invdate', viewrecords: true, sortorder: "desc", jsonReader: { repeatitems : false }, caption: "Keyboard Navigation", height: '100%', editurl : 'server.php?q=dummy' }); jQuery("#kfrmac").jqGrid('navGrid','#pfrmac',{edit:false,add:false,del:false});
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/40frmactions.js
JavaScript
art
1,120
jQuery("#list12").jqGrid({ url:'server.php?q=2', datatype: "json", colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',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, rowList:[10,20,30], pager: '#pager12', sortname: 'id', viewrecords: true, sortorder: "desc", multiselect: false, width: 500, height: "100%", caption: "Auto height example" }); jQuery("#list12").jqGrid('navGrid','#pager12',{add:false,edit:false,del:false});
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/resizeex.js
JavaScript
art
863
<div style="font-size:12px;"> This example show Autoscrolling feature when a row is selected <br/> Open the edit form and try to navigate from top to the end of grid<br/> using tha pager buttons in the edit form<br/> </div> <br /> <table id="navgrid2"></table> <div id="pagernav2"></div> <script src="navgrid2.js" type="text/javascript"> </script> <br /><br /> <div style="font-size:12px;"> <b> Description </b> <br /> <b>Java Scrpt code</b> <XMP> jQuery("#navgrid2").jqGrid({ scrollrows : true, url:'editing.php?q=1', datatype: "xml", 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},formatter: 'integer', formatoptions:{thousandsSeparator:","}}, {name:'invdate',index:'invdate', width:80,editable:true,editoptions:{size:10},formatter:'date', formatoptions: {srcformat:'Y-m-d',newformat:'Y/m/d'}}, {name:'name',index:'name', width:90,editable:true,editoptions:{size:25}}, {name:'amount',index:'amount', width:60, align:"right",editable:true,formatter:'currency',formatoptions:{thousandsSeparator:" ", decimalSeparator:",", prefix:"€"}}, {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: '#pagernav2', sortname: 'id', viewrecords: true, sortorder: "desc", caption:"Navigator Example", editurl:"someurl.php", height:150 }); jQuery("#navgrid2").jqGrid('navGrid','#pagernav2', {add:false}, //options {height:280,reloadAfterSubmit:false}, // edit options {}, // add options {reloadAfterSubmit:false}, // del options {} // search options ); </XMP>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/navgrid2.html
HTML
art
2,266
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.jsp?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" });
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/36custinput.js
JavaScript
art
1,319
<link rel="stylesheet" type="text/css" media="screen" href="themes/redmond/jquery-ui-1.8.2.custom.css" /> <link rel="stylesheet" type="text/css" media="screen" href="themes/ui.jqgrid.css" /> <link rel="stylesheet" type="text/css" media="screen" href="themes/ui.multiselect.css" /> <script src="js/jquery.min.js" type="text/javascript"></script> <script src="js/i18n/grid.locale-en.js" type="text/javascript"></script> <script src="js/jquery.jqGrid.min.js" type="text/javascript"></script> <script src="js/jquery.contextmenu.js" type="text/javascript"></script> <script src="js/jquery.layout.js" type="text/javascript"></script> <script src="js/jquery.tablednd.js" type="text/javascript"></script> <div style="font-size:12px;"> We can make a virtual scroll to a relative big local data - i.e scroll option set to 1 <br> <br> </div> <br /> <table id="scroll37"></table> <div id="pscroll37" ></div> <script src="37scroll.js" type="text/javascript"> </script> <br /> <div style="font-size:12px;"> <b> HTML </b> <XMP> ... <table id="scroll37"></table> <div id="pscroll37" ></div> </XMP> <b>Java Scrpt code</b> <XMP> ... jQuery("#scroll37").jqGrid({ url:'localset.php', datatype: "json", height: 255, width: 600, colNames:['Index','Name', 'Code'], colModel:[ {name:'item_id',index:'item_id', width:65, sorttype:'int'}, {name:'item',index:'item', width:150}, {name:'item_cd',index:'item_cd', width:100} ], rowNum:50, rowTotal: 2000, rowList : [20,30,50], scroll:1, loadonce:true, mtype: "GET", rownumbers: true, rownumWidth: 40, gridview: true, pager: '#pscroll37', sortname: 'item_id', viewrecords: true, sortorder: "asc", caption: "Virtual scrolling on local data" }); jQuery("#scroll37").jqGrid('navGrid','#pscroll37',{del:false,add:false,edit:false},{},{},{},{multipleSearch:true}); </XMP> <b>PHP with MySQL</b> <XMP> ... $page = $_REQUEST['page']; // get the requested page $limit = $_REQUEST['rows']; // get how many rows we want to have into the grid $sidx = $_REQUEST['sidx']; // get index row - i.e. user click to sort $sord = $_REQUEST['sord']; // get the direction if(!$sidx) $sidx =1; $totalrows = isset($_REQUEST['totalrows']) ? $_REQUEST['totalrows']: false; if($totalrows) { $limit = $totalrows; } // connect to the database $db = mysql_pconnect($dbhost, $dbuser, $dbpassword) or die("Connection Error: " . mysql_error()); mysql_select_db($database) or die("Error conecting to db."); //populateDBRandom(); $result = mysql_query("SELECT COUNT(*) AS count FROM items"); $row = mysql_fetch_array($result,MYSQL_ASSOC); $count = $row['count']; if( $count >0 ) { $total_pages = ceil($count/$limit); } else { $total_pages = 0; } if ($page > $total_pages) $page=$total_pages; if ($limit<0) $limit = 0; $start = $limit*$page - $limit; // do not put $limit*($page - 1) if ($start<0) $start = 0; $SQL = "SELECT item_id, item, item_cd FROM items ".$where." ORDER BY $sidx $sord LIMIT $start , $limit"; $result = mysql_query( $SQL ) or die("Couldn�t execute query.".mysql_error()); $responce->page = $page; $responce->total = $total_pages; $responce->records = $count; $i=0; while($row = mysql_fetch_array($result,MYSQL_ASSOC)) { $responce->rows[$i]['id']=$row[item_id]; $responce->rows[$i]['cell']=array($row[item_id],$row[item],$row[item_cd]); $i++; } echo json_encode($responce); mysql_close($db); ... </XMP> </div>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/37scroll.html
HTML
art
3,521
<div style="font-size:12px;"> <p style="width:750px;"> Using the new event <b>cellattr</b> in colModel we can easy configure data span. Note that with cellattribute we can set any valid attribute in the cell including style one </p> </div> <br /> <table id="colspan"></table> <div id="pcolspan"></div> <script src="40colspan.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("#colspan").jqGrid({ url:'server.php?q=4', datatype: "json", colNames:['Date', 'Inv No', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'invdate',index:'invdate', width:90}, { name:'id', key : true, index:'id', width:55, cellattr: function(rowId, value, rowObject, colModel, arrData) { return ' colspan=2'; }, formatter : function(value, options, rData){ return "Invoce: "+value + " - "+rData['name']; } }, {name:'name', index:'name', width:100, cellattr: function(rowId, value, rowObject, colModel, arrData) { return " style=display:none; "; } }, {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: '#pcolspan', sortname: 'invdate', viewrecords: true, sortorder: "desc", jsonReader: { repeatitems : false }, caption: "Data colspan", height: '100%' }); jQuery("#colspan").jqGrid('navGrid','#pcolspan',{edit:false,add:false,del:false}); </XMP>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/40colspan.html
HTML
art
1,784
jQuery("#crud").jqGrid({ url:'server.jsp?q=2', datatype: "json", colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',index:'id', width:55, editable:true, editoptions:{readonly:true}, sorttype:'int'}, {name:'invdate',index:'invdate', width:90, sorttype:'date', editable:true, editrules:{date:true},formatter:'date', datefmt:'d/m/Y'}, {name:'name',index:'name', width:100,editable:true}, {name:'amount',index:'amount', width:80, align:"right",editable:true,editrules:{number:true},sorttype:'number',formatter:'number'}, {name:'tax',index:'tax', width:80, align:"right",editable:true,editrules:{number:true},sorttype:'number',formatter:'number'}, {name:'total',index:'total', width:80,align:"right",editable:true,editrules:{number:true},sorttype:'number',formatter:'number'}, {name:'note',index:'note', width:150, sortable:false,editable:true} ], rowNum:10, rowTotal: 50, rowList:[10,20,30], pager: '#pcrud', sortname: 'id', loadonce: true, viewrecords: true, sortorder: "desc", editurl: 'server.php', // this is dummy existing url caption:"CRUD on Local Data" }); jQuery("#crud").jqGrid('navGrid','#pcrud',{});
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/37crud.js
JavaScript
art
1,272
jQuery("#navgrid").jqGrid({ url:'editing.php?q=1', datatype: "xml", 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: '#pagernav', sortname: 'id', viewrecords: true, sortorder: "desc", caption:"Navigator Example", editurl:"someurl.php", height:210 }); jQuery("#navgrid").jqGrid('navGrid','#pagernav', {}, //options {height:280,reloadAfterSubmit:false}, // edit options {height:280,reloadAfterSubmit:false}, // add options {reloadAfterSubmit:false}, // del options {} // search options );
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/navgrid.js
JavaScript
art
1,571
<div style="font-size:12px;"> With this example we demonstrate 3 new methods <br/> 1. navButtonAdd - with help of this method we can add custom buttons in page bar. <br/> 2. GridToForm - this method fill the form data from grid with a given row id and form id. <br/> 3. FormToGrid - this method fill the Grid row with data from a given form id. <br/> Select a row. Then click a edit button. Try to change some values in form and then click Save button.<br/> Note: data is not saved to the server. </div> <br/> <br/> <table id="custbut"></table> <div id="pcustbut"></div> <br/> <form method="post" name="order" id="order" action="" title='' style="width:350px;margin:0px;"> <fieldset> <legend>Invoice Data</legend> <table> <tbody> <tr> <td> Invice No:</td> <td><input type="text" name="id" readonly=true id="invid"/></td> </tr> <tr> <td> Invice Date:</td> <td><input type="text" name="invdate" /></td> </tr> <tr> <td> Client</td> <td><input type="text" name="name" /></td> </tr> <tr> <td> Amount</td> <td><input type="text" name="amount" /></td> </tr> <tr> <td> Tax</td> <td><input type="text" name="tax" /></td> </tr> <tr> <td> Total</td> <td><input type="text" name="total" /></td> </tr> <tr> <td> Note</td> <td><input type="text" name="note" /></td> </tr> <tr> <td>&nbsp;</td> <td><input type="button" id="savedata" value="Save" /></td> </tr> </tbody> </table> </fieldset> </form> <script src="custbutt.js" type="text/javascript"> </script> <br /> <br /> <div style="font-size:12px;"> <b> HTML </b> <XMP> ... <table id="custbut"></table> <div id="pcustbut"></div> <br/> <form method="post" name="order" id="order" action="" title='' style="width:350px;margin:0px;"> <fieldset> <legend>Invoice Data</legend> <table> <tbody> <tr> <td> Invice No:</td> <td><input type="text" name="id" readonly=true id="invid"/></td> </tr> <tr> <td> Invice Date:</td> <td><input type="text" name="invdate" /></td> </tr> <tr> <td> Client</td> <td><input type="text" name="name" /></td> </tr> <tr> <td> Amount</td> <td><input type="text" name="amount" /></td> </tr> <tr> <td> Tax</td> <td><input type="text" name="tax" /></td> </tr> <tr> <td> Total</td> <td><input type="text" name="total" /></td> </tr> <tr> <td> Note</td> <td><input type="text" name="note" /></td> </tr> <tr> <td>&nbsp;</td> <td><input type="button" id="savedata" value="Save" /></td> </tr> </tbody> </table> </fieldset> </form> <script src="custbutt.js" type="text/javascript"> </script> </XMP> <b>Java Scrpt code</b> <XMP> ... jQuery("#custbut").jqGrid({ url:'server.php?q=1', datatype: "xml", colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',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:5, rowList:[5,10,20], pager: '#pcustbut', sortname: 'id', viewrecords: true, sortorder: "desc", height: '100%', caption:"Custom Buttons and forms" }) jQuery("#custbut").jqGrid('navGrid','#pcustbut',{edit:false,add:false,del:false}); jQuery("#custbut").jqGrid('navButtonAdd','#pcustbut',{caption:"Edit", onClickButton:function(){ var gsr = jQuery("#custbut").jqGrid('getGridParam','selrow'); if(gsr){ jQuery("#custbut").jqGrid('GridToForm',gsr,"#order"); } else { alert("Please select Row") } } }); jQuery("#savedata").click(function(){ var invid = jQuery("#invid").val(); if(invid) { jQuery("#custbut").jqGrid('FormToGrid',invid,"#order"); } }); </XMP> <b>PHP with MySQL</b> <XMP> ... $page = $_GET['page']; // get the requested page $limit = $_GET['rows']; // get how many rows we want to have into the grid $sidx = $_GET['sidx']; // get index row - i.e. user click to sort $sord = $_GET['sord']; // get the direction if(!$sidx) $sidx =1; // connect to the database $db = mysql_connect($dbhost, $dbuser, $dbpassword) or die("Connection Error: " . mysql_error()); mysql_select_db($database) or die("Error conecting to db."); $result = mysql_query("SELECT COUNT(*) AS count FROM invheader a, clients b WHERE a.client_id=b.client_id"); $row = mysql_fetch_array($result,MYSQL_ASSOC); $count = $row['count']; if( $count >0 ) { $total_pages = ceil($count/$limit); } else { $total_pages = 0; } if ($page > $total_pages) $page=$total_pages; $start = $limit*$page - $limit; // do not put $limit*($page - 1) $SQL = "SELECT a.id, a.invdate, b.name, a.amount,a.tax,a.total,a.note FROM invheader a, clients b WHERE a.client_id=b.client_id ORDER BY $sidx $sord LIMIT $start , $limit"; $result = mysql_query( $SQL ) or die("Couldn’t execute query.".mysql_error()); if ( stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml") ) { header("Content-type: application/xhtml+xml;charset=utf-8"); } else { header("Content-type: text/xml;charset=utf-8"); } $et = ">"; echo "<?xml version='1.0' encoding='utf-8'?$et\n"; echo "<rows>"; echo "<page>".$page."</page>"; echo "<total>".$total_pages."</total>"; echo "<records>".$count."</records>"; // be sure to put text data in CDATA while($row = mysql_fetch_array($result,MYSQL_ASSOC)) { echo "<row id='". $row[id]."'>"; echo "<cell>". $row[id]."</cell>"; echo "<cell>". $row[invdate]."</cell>"; echo "<cell><![CDATA[". $row[name]."]]></cell>"; echo "<cell>". $row[amount]."</cell>"; echo "<cell>". $row[tax]."</cell>"; echo "<cell>". $row[total]."</cell>"; echo "<cell><![CDATA[". $row[note]."]]></cell>"; echo "</row>"; } echo "</rows>"; ... </XMP> </div>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/custbutt.html
HTML
art
6,306
jQuery("#list10").jqGrid({ url:'server.php?q=2', datatype: "json", colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',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, rowList:[10,20,30], pager: '#pager10', sortname: 'id', viewrecords: true, sortorder: "desc", multiselect: false, caption: "Invoice Header", onSelectRow: function(ids) { if(ids == null) { ids=0; if(jQuery("#list10_d").jqGrid('getGridParam','records') >0 ) { jQuery("#list10_d").jqGrid('setGridParam',{url:"subgrid.php?q=1&id="+ids,page:1}); jQuery("#list10_d").jqGrid('setCaption',"Invoice Detail: "+ids) .trigger('reloadGrid'); } } else { jQuery("#list10_d").jqGrid('setGridParam',{url:"subgrid.php?q=1&id="+ids,page:1}); jQuery("#list10_d").jqGrid('setCaption',"Invoice Detail: "+ids) .trigger('reloadGrid'); } } }); jQuery("#list10").jqGrid('navGrid','#pager10',{add:false,edit:false,del:false}); jQuery("#list10_d").jqGrid({ height: 100, url:'subgrid.php?q=1&id=0', datatype: "json", colNames:['No','Item', 'Qty', 'Unit','Line Total'], colModel:[ {name:'num',index:'num', width:55}, {name:'item',index:'item', width:180}, {name:'qty',index:'qty', width:80, align:"right"}, {name:'unit',index:'unit', width:80, align:"right"}, {name:'linetotal',index:'linetotal', width:80,align:"right", sortable:false, search:false} ], rowNum:5, rowList:[5,10,20], pager: '#pager10_d', sortname: 'item', viewrecords: true, sortorder: "asc", multiselect: true, caption:"Invoice Detail" }) jQuery("#list10_d").jqGrid('navGrid','#pager10_d',{add:false,edit:false,del:false}); jQuery("#ms1").click( function() { var s; s = jQuery("#list10_d").jqGrid('getGridParam','selarrrow'); alert(s); });
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/masterex.js
JavaScript
art
2,238
<div style="font-size:12px;"> This is a first of series integrations with other plugins. First of them is Datepicker.<br> Try to click on some row and select the Last Sales cell - a datapicker will popup. <br> </div> <br /> <table id="rowed6"></table> <script src="calen.js" type="text/javascript"></script> <br /> <div style="font-size:12px;"> <b> HTML </b> <XMP> <link rel="stylesheet" type="text/css" media="screen" href="themes/ui.datepicker.css" /> <script src="js/ui.datepicker.js" type="text/javascript"></script> ... <table id="rowed6"></table> </XMP> <b>Java Scrpt code</b> <XMP> var lastsel3; jQuery("#rowed6").jqGrid({ datatype: "local", height: 250, colNames:['ID Number','Last Sales','Name', 'Stock', 'Ship via','Notes'], colModel:[ {name:'id',index:'id', width:90, sorttype:"int", editable: true}, {name:'sdate',index:'sdate',width:90, editable:true, sorttype:"date"}, {name:'name',index:'name', width:150,editable: true,editoptions:{size:"20",maxlength:"30"}}, {name:'stock',index:'stock', width:60, editable: true,edittype:"checkbox",editoptions: {value:"Yes:No"}}, {name:'ship',index:'ship', width:90, editable: true,edittype:"select",editoptions:{value:"FE:FedEx;IN:InTime;TN:TNT;AR:ARAMEX"}}, {name:'note',index:'note', width:200, sortable:false,editable: true,edittype:"textarea", editoptions:{rows:"2",cols:"10"}} ], onSelectRow: function(id){ if(id && id!==lastsel3){ jQuery('#rowed6').jqGrid('restoreRow',lastsel3); jQuery('#rowed6').jqGrid('editRow',id,true,pickdates); lastsel3=id; } }, editurl: "server.php", caption: "Date Picker Integration" }); var mydata3 = [ {id:"12345",name:"Desktop Computer",note:"note",stock:"Yes",ship:"FedEx", sdate:"2007-12-03"}, {id:"23456",name:"Laptop",note:"Long text ",stock:"Yes",ship:"InTime",sdate:"2007-12-03"}, {id:"34567",name:"LCD Monitor",note:"note3",stock:"Yes",ship:"TNT",sdate:"2007-12-03"}, {id:"45678",name:"Speakers",note:"note",stock:"No",ship:"ARAMEX",sdate:"2007-12-03"}, {id:"56789",name:"Laser Printer",note:"note2",stock:"Yes",ship:"FedEx",sdate:"2007-12-03"}, {id:"67890",name:"Play Station",note:"note3",stock:"No", ship:"FedEx",sdate:"2007-12-03"}, {id:"76543",name:"Mobile Telephone",note:"note",stock:"Yes",ship:"ARAMEX",sdate:"2007-12-03"}, {id:"87654",name:"Server",note:"note2",stock:"Yes",ship:"TNT",sdate:"2007-12-03"}, {id:"98765",name:"Matrix Printer",note:"note3",stock:"No", ship:"FedEx",sdate:"2007-12-03"} ]; for(var i=0;i < mydata3.length;i++) jQuery("#rowed6").jqGrid('addRowData',mydata3[i].id,mydata3[i]); function pickdates(id){ jQuery("#"+id+"_sdate","#rowed6").datepicker({dateFormat:"yy-mm-dd"}); } </XMP> </div>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/calendar.html
HTML
art
2,773
<link rel="stylesheet" type="text/css" media="screen" href="themes/redmond/jquery-ui-1.8.2.custom.css" /> <link rel="stylesheet" type="text/css" media="screen" href="themes/ui.jqgrid.css" /> <link rel="stylesheet" type="text/css" media="screen" href="themes/ui.multiselect.css" /> <script src="js/jquery.min.js" type="text/javascript"></script> <script src="js/i18n/grid.locale-en.js" type="text/javascript"></script> <script src="js/jquery.jqGrid.min.js" type="text/javascript"></script> <script src="js/jquery.contextmenu.js" type="text/javascript"></script> <script src="js/jquery.layout.js" type="text/javascript"></script> <script src="js/jquery.tablednd.js" type="text/javascript"></script> <div style="font-size:12px;"> Another very usefull addition in grid.jqueryui.js module is adding a possibility for sortable rows.<br> In order to use this feature a jQuery UI sortable widget is used.<br/> Try to sort the rows in the grid<br> Note that all available options and evenents from sortable widget can be used <br> <br /> <table id="sortrows"></table> <div id="psortrows"></div> <script src="36sortrows.js" type="text/javascript"> </script> <br /> <div style="font-size:12px;"> <b> HTML </b> <XMP> <table id="sortrows"></table> <div id="psortrows"></div> </XMP> <b>Java Scrpt code</b> <XMP> jQuery("#sortrows").jqGrid({ url:'server.php?q=2', datatype: "json", colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',index:'id', width:55}, {name:'invdate',index:'invdate', width:90}, {name:'name',index:'name asc, invdate', 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: '#psortrows', sortname: 'invdate', viewrecords: true, sortorder: "desc", caption:"Sortable Rows Example" }); jQuery("#sortrows").jqGrid('navGrid','#psortrows',{edit:false,add:false,del:false}); jQuery("#sortrows").jqGrid('sortableRows'); </XMP> </div>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/36sortrows.html
HTML
art
2,244
<div style="font-size:12px;"> Of course Right To Left Languages are supported.<br/> </div> <br /> <table id="list484"></table> <div id="plist484"></div> <script src="38array4.js" type="text/javascript"></script> <br /> <div style="font-size:12px;"> <b> HTML </b> <XMP> ... <table id="list47"></table> <div id="plist47"></div> </XMP> <b>Java Scrpt code</b> <XMP> 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"}, {id:"6",invdate:"2007-09-06",name:"test3",note:"note3",tax:"30.00",total:"430.00"}, {id:"7",invdate:"2007-10-04",name:"test",note:"note",tax:"10.00",total:"210.00"}, {id:"8",invdate:"2007-10-03",name:"test2",note:"note2",amount:"300.00",tax:"21.00",total:"320.00"}, {id:"9",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}, {id:"11",invdate:"2007-10-01",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"}, {id:"12",invdate:"2007-10-02",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"}, {id:"13",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}, {id:"14",invdate:"2007-10-04",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"}, {id:"15",invdate:"2007-10-05",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"}, {id:"16",invdate:"2007-09-06",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}, {id:"17",invdate:"2007-10-04",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"}, {id:"18",invdate:"2007-10-03",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"}, {id:"19",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}, {id:"21",invdate:"2007-10-01",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"}, {id:"22",invdate:"2007-10-02",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"}, {id:"23",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}, {id:"24",invdate:"2007-10-04",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"}, {id:"25",invdate:"2007-10-05",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"}, {id:"26",invdate:"2007-09-06",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}, {id:"27",invdate:"2007-10-04",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"}, {id:"28",invdate:"2007-10-03",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"} ]; jQuery("#list484").jqGrid({ data: mydata, datatype: "local", height: 'auto', rowNum: 30, rowList: [10,20,30], colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','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, editable:true}, {name:'amount',index:'amount', width:80, align:"right",sorttype:"float", formatter:"number", editable:true}, {name:'tax',index:'tax', width:80, align:"right",sorttype:"float", editable:true}, {name:'total',index:'total', width:80,align:"right",sorttype:"float"}, {name:'note',index:'note', width:150, sortable:false} ], pager: "#plist484", viewrecords: true, sortname: 'name', direction : "rtl", grouping:true, groupingView : { groupField : ['name'], groupColumnShow : [false], groupText : ['<b> Items {1} {0} </b>'] }, caption: "RTL Support" }); </XMP> </div>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/38array4.html
HTML
art
4,048
jQuery("#listdt").jqGrid({ //url:'server.php?q=2', datatype : function (pdata) { $.ajax({ url:'server.php?q=2', data:pdata, dataType:"json", complete: function(jsondata,stat){ if(stat=="success") { var thegrid = jQuery("#listdt")[0]; thegrid.addJSONData(eval("("+jsondata.responseText+")")) } } }); }, colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',index:'id', width:55}, {name:'invdate',index:'invdate', width:90}, {name:'name',index:'name asc, invdate', width:100}, {name:'amount',index:'amount', width:80, align:"right", editable:true,editrules:{number:true,minValue:100,maxValue:350}}, {name:'tax',index:'tax', width:80, align:"right",editable:true,edittype:"select",editoptions:{value:"IN:InTime;TN:TNT;AR:ARAMEX"}}, {name:'total',index:'total', width:80,align:"right",editable: true,edittype:"checkbox",editoptions: {value:"Yes:No"} }, {name:'note',index:'note', width:150, sortable:false} ], rowNum:10, rowList:[10,20,30], pager: '#pagerdt', sortname: 'id', viewrecords: true, sortorder: "desc", caption:"Data type as function Example", cellEdit: true }); jQuery("#listdt").jqGrid('navGrid','#pagerdt',{edit:false,add:false,del:false});
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/datatype.js
JavaScript
art
1,362
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>jqGrid Demos</title> <link rel="stylesheet" type="text/css" media="screen" href="themes/redmond/jquery-ui-1.8.2.custom.css" /> <link rel="stylesheet" type="text/css" media="screen" href="themes/ui.jqgrid.css" /> <link rel="stylesheet" type="text/css" media="screen" href="themes/ui.multiselect.css" /> <style> html, body { margin: 0; /* Remove body margin/padding */ padding: 0; overflow: hidden; /* Remove scroll bars on browser window */ font-size: 75%; } /*Splitter style */ #LeftPane { /* optional, initial splitbar position */ overflow: auto; } /* * Right-side element of the splitter. */ #RightPane { padding: 2px; overflow: auto; } .ui-tabs-nav li {position: relative;} .ui-tabs-selected a span {padding-right: 10px;} .ui-tabs-close {display: none;position: absolute;top: 3px;right: 0px;z-index: 800;width: 16px;height: 14px;font-size: 10px; font-style: normal;cursor: pointer;} .ui-tabs-selected .ui-tabs-close {display: block;} .ui-layout-west .ui-jqgrid tr.jqgrow td { border-bottom: 0px none;} .ui-datepicker {z-index:1200;} </style> <script src="js/jquery.js" type="text/javascript"></script> <script src="js/jquery-ui-1.8.2.custom.min.js" type="text/javascript"></script> <script src="js/jquery.layout.js" type="text/javascript"></script> <script src="js/i18n/grid.locale-en.js" type="text/javascript"></script> <script type="text/javascript"> $.jgrid.no_legacy_api = true; $.jgrid.useJSON = true; </script> <script src="js/jquery.jqGrid.min.js" type="text/javascript"></script> <script src="js/jquery.tablednd.js" type="text/javascript"></script> <script src="js/jquery.contextmenu.js" type="text/javascript"></script> <script src="js/ui.multiselect.js" type="text/javascript"></script> <script type="text/javascript"> jQuery(document).ready(function(){ //$('#switcher').themeswitcher(); $('body').layout({ resizerClass: 'ui-state-default', west__onresize: function (pane, $Pane) { jQuery("#west-grid").jqGrid('setGridWidth',$Pane.innerWidth()-2); } }); $.jgrid.defaults = $.extend($.jgrid.defaults,{loadui:"enable"}); var maintab =jQuery('#tabs','#RightPane').tabs({ add: function(e, ui) { // append close thingy $(ui.tab).parents('li:first') .append('<span class="ui-tabs-close ui-icon ui-icon-close" title="Close Tab"></span>') .find('span.ui-tabs-close') .click(function() { maintab.tabs('remove', $('li', maintab).index($(this).parents('li:first')[0])); }); // select just added tab maintab.tabs('select', '#' + ui.panel.id); } }); jQuery("#west-grid").jqGrid({ url: "tree.xml", datatype: "xml", height: "auto", pager: false, loadui: "disable", colNames: ["id","Items","url"], colModel: [ {name: "id",width:1,hidden:true, key:true}, {name: "menu", width:150, resizable: false, sortable:false}, {name: "url",width:1,hidden:true} ], treeGrid: true, caption: "jqGrid Demos", ExpandColumn: "menu", autowidth: true, //width: 180, rowNum: 200, ExpandColClick: true, treeIcons: {leaf:'ui-icon-document-b'}, onSelectRow: function(rowid) { var treedata = $("#west-grid").jqGrid('getRowData',rowid); if(treedata.isLeaf=="true") { //treedata.url var st = "#t"+treedata.id; if($(st).html() != null ) { maintab.tabs('select',st); } else { maintab.tabs('add',st, treedata.menu); $(st,"#tabs").load(treedata.url); } } } }); // end splitter }); </script> </head> <body> <script type="text/javascript" //src="http://ui.jquery.com/themeroller/themeswitchertool/"> </script> <div id="LeftPane" class="ui-layout-west ui-widget ui-widget-content"> <table id="west-grid"></table> </div> <!-- #LeftPane --> <div id="RightPane" class="ui-layout-center ui-helper-reset ui-widget-content" ><!-- Tabs pane --> <div id="switcher"></div> <div id="tabs" class="jqgtabs"> <ul> <li><a href="#tabs-1">jqGrid 3.6</a></li> </ul> <div id="tabs-1" style="font-size:12px;"> Many Thanks to Mark Williams which do the most of the new things added in 3.6<br/> <br/> Enjoy </div> </div> </div> <!-- #RightPane --> </body> <!-- Piwik --> <script type="text/javascript"> var pkBaseURL = (("https:" == document.location.protocol) ? "https://www.trirand.com/piwik/" : "http://www.trirand.com/piwik/"); document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E")); </script><script type="text/javascript"> try { var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 1); piwikTracker.trackPageView(); piwikTracker.enableLinkTracking(); } catch( err ) {} </script> <!-- End Piwik Tag --> </html>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/jqgrid.html
HTML
art
5,361
<link rel="stylesheet" type="text/css" media="screen" href="themes/redmond/jquery-ui-1.8.2.custom.css" /> <link rel="stylesheet" type="text/css" media="screen" href="themes/ui.jqgrid.css" /> <link rel="stylesheet" type="text/css" media="screen" href="themes/ui.multiselect.css" /> <script src="js/jquery.min.js" type="text/javascript"></script> <script src="js/i18n/grid.locale-en.js" type="text/javascript"></script> <script src="js/jquery.jqGrid.min.js" type="text/javascript"></script> <script src="js/jquery.contextmenu.js" type="text/javascript"></script> <script src="js/jquery.layout.js" type="text/javascript"></script> <script src="js/jquery.tablednd.js" type="text/javascript"></script> <div style="font-size:12px;"> Adding,Updating and Deleteing is possible on local data too. In this example we use a form edit.<br/> <br/><br/> </div> <br /> <table id="crud"></table> <div id="pcrud"></div> <script src="37crud.js" type="text/javascript"></script> <br /> <div style="font-size:12px;"> <b> HTML </b> <XMP> ... <table id="list4"><tr><td>&nbsp;</td></tr></table> </XMP> <b>Java Scrpt code</b> <XMP> jQuery("#crud").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, editoptions:{readonly:true}, sorttype:'int'}, {name:'invdate',index:'invdate', width:90, sorttype:'date', editable:true, editrules:{date:true},formatter:'date', datefmt:'d/m/Y'}, {name:'name',index:'name asc, invdate', width:100,editable:true}, {name:'amount',index:'amount', width:80, align:"right",editable:true,editrules:{number:true},sorttype:'number',formatter:'number'}, {name:'tax',index:'tax', width:80, align:"right",editable:true,editrules:{number:true},sorttype:'number',formatter:'number'}, {name:'total',index:'total', width:80,align:"right",editable:true,editrules:{number:true},sorttype:'number',formatter:'number'}, {name:'note',index:'note', width:150, sortable:false,editable:true} ], rowNum:10, rowTotal: 50, rowList:[10,20,30], pager: '#pcrud', sortname: 'id', loadonce: true, viewrecords: true, sortorder: "desc", editurl: 'server.php', // this is dummy existing url caption:"CRUD on Local Data" }); jQuery("#crud").jqGrid('navGrid','#pcrud',{}); </XMP> </div>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/37crud.html
HTML
art
2,452
<table id="list1"></table> <div id="pager1"></div> <br/> <br/> <div id="acc_list1"> <div> <h3><a href="#">HTML and Java script </a></h3> <div style="font-size:12px;"> <XMP> <html> ... <table id="list1"></table> <div id="pager1"></div> ... </html> <script type="text/javascript"> jQuery().ready(function (){ jQuery("#list1").jqGrid({ url:'server.php?q=1', datatype: "xml", colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',index:'id', width:75}, {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, autowidth: true, rowList:[10,20,30], pager: jQuery('#pager1'), sortname: 'id', viewrecords: true, sortorder: "desc", caption:"XML Example" }).navGrid('#pager1',{edit:false,add:false,del:false}); </script> </XMP> </div> </div> <div> <h3><a href="#">PHP Code</a></h3> <div style="font-size:12px;"> <XMP> <?php $page = $_GET['page']; // get the requested page $limit = $_GET['rows']; // get how many rows we want to have into the grid $sidx = $_GET['sidx']; // get index row - i.e. user click to sort $sord = $_GET['sord']; // get the direction if(!$sidx) $sidx =1; // connect to the database $db = mysql_connect($dbhost, $dbuser, $dbpassword) or die("Connection Error: " . mysql_error()); mysql_select_db($database) or die("Error conecting to db."); $result = mysql_query("SELECT COUNT(*) AS count FROM invheader a, clients b WHERE a.client_id=b.client_id"); $row = mysql_fetch_array($result,MYSQL_ASSOC); $count = $row['count']; if( $count >0 ) { $total_pages = ceil($count/$limit); } else { $total_pages = 0; } if ($page > $total_pages) $page=$total_pages; $start = $limit*$page - $limit; // do not put $limit*($page - 1) $SQL = "SELECT a.id, a.invdate, b.name, a.amount,a.tax,a.total,a.note FROM invheader a, clients b WHERE " ." a.client_id=b.client_id ORDER BY $sidx $sord LIMIT $start , $limit"; $result = mysql_query( $SQL ) or die("Couldn’t execute query.".mysql_error()); if ( stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml") ) { header("Content-type: application/xhtml+xml;charset=utf-8"); } else { header("Content-type: text/xml;charset=utf-8"); } $et = ">"; echo "<?xml version='1.0' encoding='utf-8'?$et\n"; echo "<rows>"; echo "<page>".$page."</page>"; echo "<total>".$total_pages."</total>"; echo "<records>".$count."</records>"; // be sure to put text data in CDATA while($row = mysql_fetch_array($result,MYSQL_ASSOC)) { echo "<row id='". $row[id]."'>"; echo "<cell>". $row[id]."</cell>"; echo "<cell>". $row[invdate]."</cell>"; echo "<cell><![CDATA[". $row[name]."]]></cell>"; echo "<cell>". $row[amount]."</cell>"; echo "<cell>". $row[tax]."</cell>"; echo "<cell>". $row[total]."</cell>"; echo "<cell><![CDATA[". $row[note]."]]></cell>"; echo "</row>"; } echo "</rows>"; ?> </XMP> </div> </div> </div> <script type="text/javascript"> jQuery().ready(function (){ jQuery("#list1").jqGrid({ url:'server.php?q=1', datatype: "xml", colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',index:'id', width:75}, {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, autowidth: true, rowList:[10,20,30], pager: jQuery('#pager1'), sortname: 'id', viewrecords: true, sortorder: "desc", caption:"XML Example" }); jQuery("#list1").jqGrid('navGrid','#pager1',{edit:false,add:false,del:false}); }); </script>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/xmlex.html
HTML
art
4,209
<div style="font-size:12px;"> This example show Client side validation in form edit.Again with this there is a<br/> option to edit easy initially hidden fields. You can see that the field tax is hidden,<br/> but in the form it is editable. The alowed values in tax fields are between 40 and 100<br/> The field of date is required. </div> <br /> <table id="csvalid"></table> <div id="pcsvalid"></div> <script src="csvalid.js" type="text/javascript"> </script> <br /><br /> <div style="font-size:12px;"> </XMP> <b>Java Scrpt code</b> <XMP> jQuery("#csvalid").jqGrid({ url:'editing.php?q=1', datatype: "xml", 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},editrules:{required:true}}, {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", hidden:true,editable:true,editoptions:{size:10},editrules:{edithidden:true,required:true,number:true,minValue:40,maxValue:100}}, {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: '#pcsvalid', sortname: 'id', viewrecords: true, sortorder: "desc", caption:"Validation Example", editurl:"someurl.php", height:210 }); jQuery("#csvalid").jqGrid('navGrid','#pcsvalid', {}, //options {height:280,reloadAfterSubmit:false}, // edit options {height:280,reloadAfterSubmit:false}, // add options {reloadAfterSubmit:false}, // del options {} // search options ); </XMP> </div>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/csvalid.html
HTML
art
2,287
<div style="font-size:12px;"> This example show how we can load array data. In this case we use a addRowData method. </div> <br /> <table id="list4"></table> <script src="localex.js" type="text/javascript"></script> <br /> <div style="font-size:12px;"> <b> HTML </b> <XMP> ... <table id="list4"></table> </XMP> <b>Java Scrpt code</b> <XMP> jQuery("#list4").jqGrid({ datatype: "local", height: 250, colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',index:'id', width:60, sorttype:"int"}, {name:'invdate',index:'invdate', width:90, sorttype:"date"}, {name:'name',index:'name', width:100}, {name:'amount',index:'amount', width:80, align:"right",sorttype:"float"}, {name:'tax',index:'tax', width:80, align:"right",sorttype:"float"}, {name:'total',index:'total', width:80,align:"right",sorttype:"float"}, {name:'note',index:'note', width:150, sortable:false} ], multiselect: true, caption: "Manipulating Array Data" }); var mydata = [ {id:"1",invdate:"2007-10-01",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"}, {id:"2",invdate:"2007-10-02",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"}, {id:"3",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}, {id:"4",invdate:"2007-10-04",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"}, {id:"5",invdate:"2007-10-05",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"}, {id:"6",invdate:"2007-09-06",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}, {id:"7",invdate:"2007-10-04",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"}, {id:"8",invdate:"2007-10-03",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"}, {id:"9",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"} ]; for(var i=0;i<=mydata.length;i++) jQuery("#list4").jqGrid('addRowData',i+1,mydata[i]); </XMP> </div>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/localex.html
HTML
art
2,110
jQuery("#colr").jqGrid({ sortable: true, url:'server.jsp?q=2', datatype: "json", colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',index:'id', width:55}, {name:'invdate',index:'invdate', width:90}, {name:'name',index:'name asc, invdate', 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, rowList:[10,20,30], pager: '#pcolr', sortname: 'invdate', viewrecords: true, sortorder: "desc", caption:"Column Reordering Example" }); jQuery("#colr").jqGrid('navGrid','#pcolr',{add:false,edit:false,del:false});
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/36colreorder.js
JavaScript
art
839
<link rel="stylesheet" type="text/css" media="screen" href="themes/redmond/jquery-ui-1.8.2.custom.css" /> <link rel="stylesheet" type="text/css" media="screen" href="themes/ui.jqgrid.css" /> <script src="js/jquery.min.js" type="text/javascript"></script> <script src="js/i18n/grid.locale-en.js" type="text/javascript"></script> <script src="js/jquery.jqGrid.min.js" type="text/javascript"></script> <div style="font-size:12px;"> In 3.6 we have done so that the developer can controll full the ajax requests to the server. For this purpose<br> we created a 3 level of settings <br/> 1. common ajax settings for all modules that use ajax requests <br/> 2. specific ajax settings for every module<br/> 3. serialize function which can be used to serialize the data to the server in a way that the developer want<br/> In this example we set the grid to use a POST to the server and in the serialize function we set the things so<br> that only the first page should be returned<br> <br /> <table id="jqgajax"></table> <div id="pjqgajax"></div> <script src="36ajaxing.js" type="text/javascript"> </script> <br /> <div style="font-size:12px;"> <b> HTML </b> <XMP> <table id="jqgajax"></table> <div id="jqgajax"></div> </XMP> <b>Java Scrpt code</b> <XMP> jQuery("#jqgajax").jqGrid({ ajaxGridOptions : {type:"POST"}, serializeGridData : function(postdata) { postdata.page = 1; return postdata; }, url:'server.jsp?q=2', datatype: "json", colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',index:'id', width:55}, {name:'invdate',index:'invdate', width:90}, {name:'name',index:'name asc, invdate', 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: '#pjqgajax', sortname: 'invdate', viewrecords: true, sortorder: "desc", caption:"New API Example" }); jQuery("#pjqgajax").jqGrid('navGrid','#pjqgajax',{edit:false,add:false,del:false}); </XMP> </div>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/36ajaxing.html
HTML
art
2,292
jQuery("#delgrid").jqGrid({ url:'editing.php?q=1', datatype: "xml", 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: '#pagerde', sortname: 'id', viewrecords: true, sortorder: "desc", caption:"Deleteing Example", editurl:"someurl.php" }); $("#dedata").click(function(){ var gr = jQuery("#delgrid").jqGrid('getGridParam','selrow'); //getSelectedRow(); if( gr != null ) jQuery("#delgrid").jqGrid('delGridRow',gr,{reloadAfterSubmit:false}); else alert("Please Select Row to delete!"); });
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/deleting.js
JavaScript
art
1,580
<p style="font-size:12px;"> This sample demonstrates how jqGrid works with large amount of data.<br> We have put into a table in a Mysql database about 12.000 records filled with random words. jqGrid, using Ajax, loads only those records, that are visible.<br> If you want to make a search (just enter some word into input fields), grid sends search criteria to server and loads only data that correspond to entered criteria.<br> Speed is increased about 2 times if we index the column. In this case this is column Code<br> <i>Important: sample is working with real data - <b>12.000</b> records! Enjoy it's performance</i> <br /> <div class="h">Search By:</div> <div> Code<br /> <input type="text" id="search_cd" onkeydown="doSearch(arguments[0]||event)" /> <input type="checkbox" id="autosearch" onclick="enableAutosubmit(this.checked)"> Enable Autosearch <br/> </div> <div> Name<br> <input type="text" id="item_nm" onkeydown="doSearch(arguments[0]||event)" /> <button onclick="gridReload()" id="submitButton" style="margin-left:30px;">Search</button> </div> <br /> <table id="bigset" ></table> <div id="pagerb"></div> <script src="bigset.js" type="text/javascript"> </script> <br /> <div style="font-size:12px;"> <b> HTML </b> <XMP> ... <div class="h">Search By:</div> <div> <input type="checkbox" id="autosearch" onclick="enableAutosubmit(this.checked)"> Enable Autosearch <br/> Code<br /> <input type="text" id="search_cd" onkeydown="doSearch(arguments[0]||event)" /> </div> <div> Name<br> <input type="text" id="item" onkeydown="doSearch(arguments[0]||event)" /> <button onclick="gridReload()" id="submitButton" style="margin-left:30px;">Search</button> </div> <br /> <table id="bigset"></table> <div id="pagerb"></div> <script src="bigset.js" type="text/javascript"> </script> </XMP> <b>Java Scrpt code</b> <XMP> jQuery("#bigset").jqGrid({ url:'bigset.php', datatype: "json", height: 255, colNames:['Index','Name', 'Code'], colModel:[ {name:'item_id',index:'item_id', width:65}, {name:'item',index:'item', width:150}, {name:'item_cd',index:'item_cd', width:100} ], rowNum:12, // rowList:[10,20,30], mtype: "POST", pager: jQuery('#pagerb'), pgbuttons: false, pgtext: false, pginput:false, sortname: 'item_id', viewrecords: true, sortorder: "asc" }); var timeoutHnd; var flAuto = false; function doSearch(ev){ if(!flAuto) return; // var elem = ev.target||ev.srcElement; if(timeoutHnd) clearTimeout(timeoutHnd) timeoutHnd = setTimeout(gridReload,500) } function gridReload(){ var nm_mask = jQuery("#item_nm").val(); var cd_mask = jQuery("#search_cd").val(); jQuery("#bigset").jqGrid('setGridParam',{url:"bigset.php?nm_mask="+nm_mask+"&cd_mask="+cd_mask,page:1}).trigger("reloadGrid"); } function enableAutosubmit(state){ flAuto = state; jQuery("#submitButton").attr("disabled",state); } </XMP> <b>PHP with MySQL (bigset.php)</b> <XMP> <?php ini_set('max_execution_time', 600); include("dbconfig.php"); // coment the above lines if php 5 include("JSON.php"); $json = new Services_JSON(); // end comment $examp = $_GET["q"]; //query number $page = $_GET['page']; // get the requested page $limit = $_GET['rows']; // get how many rows we want to have into the grid $sidx = $_GET['sidx']; // get index row - i.e. user click to sort $sord = $_GET['sord']; // get the direction if(!$sidx) $sidx =1; if(isset($_GET["nm_mask"])) $nm_mask = $_GET['nm_mask']; else $nm_mask = ""; if(isset($_GET["cd_mask"])) $cd_mask = $_GET['cd_mask']; else $cd_mask = ""; //construct where clause $where = "WHERE 1=1"; if($nm_mask!='') $where.= " AND item LIKE '$nm_mask%'"; if($cd_mask!='') $where.= " AND item_cd LIKE '$cd_mask%'"; // connect to the database $db = mysql_pconnect($dbhost, $dbuser, $dbpassword) or die("Connection Error: " . mysql_error()); mysql_select_db($database) or die("Error conecting to db."); $result = mysql_query("SELECT COUNT(*) AS count FROM items ".$where); $row = mysql_fetch_array($result,MYSQL_ASSOC); $count = $row['count']; if( $count >0 ) { $total_pages = ceil($count/$limit); } else { $total_pages = 0; } if ($page > $total_pages) $page=$total_pages; if ($limit<0) $limit = 0; $start = $limit*$page - $limit; // do not put $limit*($page - 1) if ($start<0) $start = 0; $SQL = "SELECT item_id, item, item_cd FROM items ".$where." ORDER BY $sidx $sord LIMIT $start , $limit"; $result = mysql_query( $SQL ) or die("Couldn’t execute query.".mysql_error()); $responce->page = $page; $responce->total = $total_pages; $responce->records = $count; $i=0; while($row = mysql_fetch_array($result,MYSQL_ASSOC)) { $responce->rows[$i]['id']=$row[item_id]; $responce->rows[$i]['cell']=array($row[item_id],$row[item],$row[item_cd]); $i++; } echo $json->encode($responce); // coment if php 5 //echo json_encode($responce); mysql_close($db); ?> </XMP> </div>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/bigset.html
HTML
art
5,052
<div style="font-size:12px;"> It is possible to tell the grid to hide the grouping column.<br/> This is done with the groupColumnShow option in the groupingView object.<br/><br/> Note that all groupingView options can be changed dynamically. </div> <br /> <table id="list482"></table> <div id="plist482"></div> <script src="38array2.js" type="text/javascript"></script> <br /> <div style="font-size:12px;"> <b> HTML </b> <XMP> ... <table id="list47"></table> <div id="plist47"></div> </XMP> <b>Java Scrpt code</b> <XMP> 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"}, {id:"6",invdate:"2007-09-06",name:"test3",note:"note3",tax:"30.00",total:"430.00"}, {id:"7",invdate:"2007-10-04",name:"test",note:"note",tax:"10.00",total:"210.00"}, {id:"8",invdate:"2007-10-03",name:"test2",note:"note2",amount:"300.00",tax:"21.00",total:"320.00"}, {id:"9",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}, {id:"11",invdate:"2007-10-01",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"}, {id:"12",invdate:"2007-10-02",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"}, {id:"13",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}, {id:"14",invdate:"2007-10-04",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"}, {id:"15",invdate:"2007-10-05",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"}, {id:"16",invdate:"2007-09-06",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}, {id:"17",invdate:"2007-10-04",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"}, {id:"18",invdate:"2007-10-03",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"}, {id:"19",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}, {id:"21",invdate:"2007-10-01",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"}, {id:"22",invdate:"2007-10-02",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"}, {id:"23",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}, {id:"24",invdate:"2007-10-04",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"}, {id:"25",invdate:"2007-10-05",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"}, {id:"26",invdate:"2007-09-06",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}, {id:"27",invdate:"2007-10-04",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"}, {id:"28",invdate:"2007-10-03",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"}, {id:"29",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"} ]; jQuery("#list482").jqGrid({ data: mydata, datatype: "local", height: 'auto', rowNum: 30, rowList: [10,20,30], colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','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, editable:true}, {name:'amount',index:'amount', width:80, align:"right",sorttype:"float", formatter:"number", editable:true}, {name:'tax',index:'tax', width:80, align:"right",sorttype:"float", editable:true}, {name:'total',index:'total', width:80,align:"right",sorttype:"float"}, {name:'note',index:'note', width:150, sortable:false} ], pager: "#plist482", viewrecords: true, sortname: 'name', grouping:true, groupingView : { groupField : ['name'], groupColumnShow : [false] }, caption: "Hide Grouping Column" }); </XMP> </div>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/38array2.html
HTML
art
4,257
var mygrid = jQuery("#s3list").jqGrid({ url:'search.php?q=1', datatype: "json", width: 700, colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',index:'id', width:65}, {name:'invdate',index:'invdate', width:90,searchoptions:{dataInit:function(el){$(el).datepicker({dateFormat:'yy-mm-dd'});} }}, {name:'name',index:'name', width:100}, {name:'amount',index:'amount', width:80, align:"right"}, {name:'tax',index:'tax', width:80, align:"right", stype:'select', editoptions:{value:":All;0.00:0.00;12:12.00;20:20.00;40:40.00;60:60.00;120:120.00"}}, {name:'total',index:'total', width:80,align:"right"}, {name:'note',index:'note', width:150, sortable:false} ], rowNum:10, mtype: "POST", rowList:[10,20,30], pager: '#s3pager', sortname: 'id', viewrecords: true, rownumbers: true, sortorder: "desc", gridview : true, caption:"Toolbar Search Example" }); jQuery("#s3list").jqGrid('navGrid','#s3pager',{edit:false,add:false,del:false,search:false,refresh:false}); jQuery("#s3list").jqGrid('navButtonAdd',"#s3pager",{caption:"Toggle",title:"Toggle Search Toolbar", buttonicon :'ui-icon-pin-s', onClickButton:function(){ mygrid[0].toggleToolbar() } }); jQuery("#s3list").jqGrid('navButtonAdd',"#s3pager",{caption:"Clear",title:"Clear Search",buttonicon :'ui-icon-refresh', onClickButton:function(){ mygrid[0].clearToolbar() } }); jQuery("#s3list").jqGrid('filterToolbar');
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/search3.js
JavaScript
art
1,539
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"}, {id:"6",invdate:"2007-09-06",name:"test3",note:"note3",tax:"30.00",total:"430.00"}, {id:"7",invdate:"2007-10-04",name:"test",note:"note",tax:"10.00",total:"210.00"}, {id:"8",invdate:"2007-10-03",name:"test2",note:"note2",amount:"300.00",tax:"21.00",total:"320.00"}, {id:"9",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}, {id:"11",invdate:"2007-10-01",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"}, {id:"12",invdate:"2007-10-02",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"}, {id:"13",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}, {id:"14",invdate:"2007-10-04",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"}, {id:"15",invdate:"2007-10-05",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"}, {id:"16",invdate:"2007-09-06",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}, {id:"17",invdate:"2007-10-04",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"}, {id:"18",invdate:"2007-10-03",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"}, {id:"19",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}, {id:"21",invdate:"2007-10-01",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"}, {id:"22",invdate:"2007-10-02",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"}, {id:"23",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}, {id:"24",invdate:"2007-10-04",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"}, {id:"25",invdate:"2007-10-05",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"}, {id:"26",invdate:"2007-09-06",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}, {id:"27",invdate:"2007-10-04",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"}, {id:"28",invdate:"2007-10-03",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"}, {id:"29",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"} ]; var lastgridsel; jQuery("#list47").jqGrid({ data: mydata, datatype: "local", height: 150, rowNum: 10, rowList: [10,20,30], colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','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, editable:true}, {name:'amount',index:'amount', width:80, align:"right",sorttype:"float", formatter:"number", editable:true}, {name:'tax',index:'tax', width:80, align:"right",sorttype:"float", editable:true}, {name:'total',index:'total', width:80,align:"right",sorttype:"float"}, {name:'note',index:'note', width:150, sortable:false} ], pager: "#plist47", viewrecords: true, caption: "Manipulating Array Data", onSelectRow: function(id) { if (id && id !== lastgridsel) { jQuery('#list47').jqGrid('saveRow',lastgridsel, false, 'clientArray'); jQuery('#list47').jqGrid('editRow',id, true, null, null,'clientArray'); lastgridsel = id; } } });
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/37array.js
JavaScript
art
3,853
jQuery("#method32").jqGrid({ url:'server.php?q=1', datatype: "xml", colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',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, rowList:[10,20,30], pager: '#pmethod32', sortname: 'id', viewrecords: true, sortorder: "desc", caption:"setLabel/setCell methods", multiselect: true, loadui: "block" }); jQuery("#method32").jqGrid('navGrid','#pmethod32',{edit:false,add:false,del:false}); jQuery("#shc").click( function() { $("#method32").jqGrid('setLabel',"tax","Tax Amt",{'font-weight': 'bold','font-style': 'italic'}); }); jQuery("#scc").click( function() { $("#method32").jqGrid('setCell',"12","tax","",{'font-weight': 'bold',color: 'red','text-align':'center'}); }); jQuery("#cdat").click( function() { $("#method32").jqGrid('clearGridData'); });
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/methods32.js
JavaScript
art
1,256
jQuery("#custbut").jqGrid({ url:'server.php?q=1', datatype: "xml", colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',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:5, rowList:[5,10,20], pager: '#pcustbut', sortname: 'id', viewrecords: true, sortorder: "desc", height: '100%', caption:"Custom Buttons and forms" }) jQuery("#custbut").jqGrid('navGrid','#pcustbut',{edit:false,add:false,del:false}); jQuery("#custbut").jqGrid('navButtonAdd','#pcustbut',{caption:"Edit", onClickButton:function(){ var gsr = jQuery("#custbut").jqGrid('getGridParam','selrow'); if(gsr){ jQuery("#custbut").jqGrid('GridToForm',gsr,"#order"); } else { alert("Please select Row") } } }); jQuery("#savedata").click(function(){ var invid = jQuery("#invid").val(); if(invid) { jQuery("#custbut").jqGrid('FormToGrid',invid,"#order"); } });
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/custbutt.js
JavaScript
art
1,303
<div style="font-size:12px;"> This example show how we can delete data.<br/> See below for all available options. <br/> Note: The data is not deleted from server<br/> </div> <br /> <table id="delgrid" ></table> <div id="pagerde"></div> <input type="BUTTON" id="dedata" value="Delete Selected" /> <script src="deleting.js" type="text/javascript"> </script> <br /><br /> <div style="font-size:12px;"> <b> Description </b> <br /> This method uses <b>colModel</b> and <b>editurl</b> parameters from jqGrid <br/> <code> Calling: jQuery("#grid_id").jqGrid('delGridRow', row_id_s,options ); </code> <br/> <b>row_id_s</b> is the row to delete. When in multiselect automatially delete the selected rows <br /> <b> options </b> <br/> <b>top : 0</b> the initial top position of edit dialog<br/> <b>left: 0</b> the initinal left position of edit dialog<br/> If the left and top positions are not set the dialog apper on<br/> upper left corner of the grid <br/> <b>width: 0</b>, the width of edit dialog - default 300<br/> <b>height: 0</b>, the height of edit dialog default 200<br/> <b>modal: false</b>, determine if the dialog should be in modal mode default is false<br/> <b>drag: true</b>,determine if the dialog is dragable default true<br/> <b>msg: "Delete selected row(s)</b>,message to display when deleting the row<br/> <b>caption: "Delete Record"</b>,the caption of the dialog<br/> <b>bSubmit: "Submit"</b>, the text of the button when you click to data default Submit<br/> <b>bCancel: "Cancel"</b>,the text of the button when you click to close dialog default Cancel<br/> <b>url: </b>, url where to post data. If set replace the editurl <br/> <b>reloadAfterSubmit : true</b> reloads grid data after posting default is true <br/> // <i>Events</i> <br/> <b>beforeShowForm: null</b> fires before showing the form data.<br/> Paramter passed to the event is the id of the constructed form.<br/> <b>afterShowForm: null</b> fires after the form is shown.<br/> Paramter passed to the event is the id of the constructed form.<br/> <b>beforeSubmit: null</b> fires before the data is submitted to the server<br/> Paramter is of type id=value1,value2,... When called the event can return array <br/> where the first parameter can be true or false and the second is the message of the error if any<br/> Example: [false,"The value is not valid"]<br/> <b>afterSubmit: null</b> fires after the data is posted to the server. Typical this <br/> event is used to recieve status form server if the data is posted with success.<br/> Parameters to this event are the returned data from the request and array of the<br/> posted values of type id=value1,value2<br/> <br/> <b> HTML </b> <XMP> ... <<table id="editgrid"></table> <div id="pagered"></div> <input type="BUTTON" id="bedata" value="Edit Selected" /> </XMP> <b>Java Scrpt code</b> <XMP> jQuery("#delgrid").jqGrid({ url:'editing.php?q=1', datatype: "xml", 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: '#pagerde', sortname: 'id', viewrecords: true, sortorder: "desc", caption:"Deleteing Example", editurl:"someurl.php" }); $("#dedata").click(function(){ var gr = jQuery("#delgrid").jqGrid('getGridParam','selrow'); if( gr != null ) jQuery("#delgrid").jqGrid('delGridRow',gr,{reloadAfterSubmit:false}); else alert("Please Select Row to delete!"); }); </XMP> </div>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/deleting.html
HTML
art
4,479
function mycheck(value, name) { if(parseFloat(value) >= 200 && parseFloat(value)<=300) { return [true,"",""]; } else { return [false,name+": The value should be between 200 and 300!",""]; } } jQuery("#custv").jqGrid({ url:'server.jsp?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}, {name:'amount',index:'amount', width:80, align:"right",editable:true,editrules:{custom:true,custom_func:mycheck}}, {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} ], rowNum:10, rowList:[10,20,30], pager: '#pcustv', sortname: 'invdate', viewrecords: true, sortorder: "desc", caption:"Custom Validation", editurl: "server.php?q=dummy" }); jQuery("#custv").jqGrid('navGrid','#pcustv',{del:false},{reloadAfterSubmit:false},{reloadAfterSubmit:false});
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/36custvalid.js
JavaScript
art
1,236
jQuery("#list2").jqGrid({ url:'server.php?q=2', datatype: "json", colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',index:'id', width:55}, {name:'invdate',index:'invdate', width:90}, {name:'name',index:'name asc, invdate', 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, rowList:[10,20,30], pager: '#pager2', sortname: 'id', viewrecords: true, sortorder: "desc", caption:"JSON Example" }); jQuery("#list2").jqGrid('navGrid','#pager2',{edit:false,add:false,del:false});
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/jsonex.js
JavaScript
art
813
jQuery("#params").jqGrid({ url:'server.php', datatype: "xml", colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',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, rowList:[10,20,30], pager: '#pparams', sortname: 'id', mtype: "POST", postData:{q:1}, viewrecords: true, sortorder: "desc", caption:"New Methods" }); jQuery("#params").jqGrid('navGrid','#pparams',{edit:false,add:false,del:false}); jQuery("#pp1").click( function() { $.extend($.jgrid.defaults,{recordtext: "{0} - {1} of {2} Record(s)",loadtext: "Processing"}); alert("New parameters are set - reopen the grid"); });
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/defparams.js
JavaScript
art
1,033
jQuery("#list6").jqGrid({ url:'server.php?q=2&nd='+new Date().getTime(), datatype: "json", colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',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, //rowList:[10,20,30], pager: '#pager6', sortname: 'id', viewrecords: true, sortorder: "desc", onSortCol: function(name,index){ alert("Column Name: "+name+" Column Index: "+index);}, ondblClickRow: function(id){ alert("You double click row with id: "+id);}, caption:" Get Methods", height: 200 }); jQuery("#list6").jqGrid('navGrid',"#pager6",{edit:false,add:false,del:false});
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/getex.js
JavaScript
art
1,014
<%@ page language="java" import="java.util.*" contentType="text/html; charset=utf-8" pageEncoding="GBK"%> <% String examp = request.getParameter("q"); System.out.println(examp); String pa = request.getParameter("page"); System.out.println(pa); %> { "page":<%= pa %>, "total":"100", "records":"1000", "rows":[ {"id":"0","cell":["id0","invdate", "name", "amount","tax","total","note"]}, {"id":"1","cell":["id1","invdate", "name", "amount","tax","total","note"]}, {"id":"2","cell":["id2","invdate", "name", "amount","tax","total","note"]}, {"id":"3","cell":["id3","invdate", "name", "amount","tax","total","note"]}, {"id":"4","cell":["id4","invdate", "name", "amount","tax","total","note"]}, {"id":"5","cell":["id5","invdate", "name", "amount","tax","total","note"]}, {"id":"6","cell":["id6","invdate", "name", "amount","tax","total","note"]}, {"id":"7","cell":["id7","invdate", "name", "amount","tax","total","note"]}, {"id":"8","cell":["id8","invdate", "name", "amount","tax","total","note"]}, {"id":"9","cell":["id9","invdate", "name", "amount","tax","total","note"]} ] }
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/bigset.jsp
Java Server Pages
art
1,120
<div style="font-size:12px;"> Another usefull option requestated many times: Now we can show the summary footer row<br/> when the group header is collapsed. This is done with the option showSummaryOnHide set to true.<br/><br/> </div> <br /> <table id="58remote2"></table> <div id="p58remote2"></div> <script src="38remote5.js" type="text/javascript"></script> <br /> <div style="font-size:12px;"> <b> HTML </b> <XMP> ... <table id="list4"><tr><td>&nbsp;</td></tr></table> </XMP> <b>Java Scrpt code</b> <XMP> jQuery("#58remote2").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, sorttype:'int',summaryType:'count', summaryTpl : '({0}) total'}, {name:'invdate',index:'invdate', width:90, sorttype:'date', formatter:'date', datefmt:'d/m/Y'}, {name:'name',index:'name', width:100}, {name:'amount',index:'amount', width:80, align:"right", sorttype:'number',formatter:'number',summaryType:'sum'}, {name:'tax',index:'tax', width:80, align:"right",sorttype:'number',formatter:'number',summaryType:'sum'}, {name:'total',index:'total', width:80,align:"right",sorttype:'number',formatter:'number', summaryType:'sum'}, {name:'note',index:'note', width:150, sortable:false,editable:true} ], rowNum: 10, rowList:[10,20,30], height: 'auto', pager: '#p58remote2', sortname: 'invdate', viewrecords: true, sortorder: "desc", caption:"Grouping with remote data", grouping: true, groupingView : { groupField : ['name'], groupColumnShow : [true], groupText : ['<b>{0}</b>'], groupCollapse : false, groupOrder: ['asc'], groupSummary : [true], showSummaryOnHide: true, groupDataSorted : true }, footerrow: true, userDataOnFooter: true }); jQuery("#58remote2").jqGrid('navGrid','#p58remote2',{add:false,edit:false,del:false}); </XMP> <b>PHP MySQL code</b> <XMP> examp = $_REQUEST["q"]; //query number $page = $_REQUEST['page']; // get the requested page $limit = $_REQUEST['rows']; // get how many rows we want to have into the grid $sidx = $_REQUEST['sidx']; // get index row - i.e. user click to sort $sord = $_REQUEST['sord']; // get the direction if(!$sidx) $sidx =1; ... $result = mysql_query("SELECT COUNT(*) AS count FROM invheader a, clients b WHERE a.client_id=b.client_id".$wh); $row = mysql_fetch_array($result,MYSQL_ASSOC); $count = $row['count']; if( $count >0 ) { $total_pages = ceil($count/$limit); } else { $total_pages = 0; } if ($page > $total_pages) $page=$total_pages; $start = $limit*$page - $limit; // do not put $limit*($page - 1) if ($start<0) $start = 0; $SQL = "SELECT a.id, a.invdate, b.name, a.amount,a.tax,a.total,a.note FROM invheader a, clients b WHERE a.client_id=b.client_id".$wh." ORDER BY ".$sidx." ".$sord. " LIMIT ".$start." , ".$limit; $result = mysql_query( $SQL ) or die("Could not execute query.".mysql_error()); $responce->page = $page; $responce->total = $total_pages; $responce->records = $count; $i=0; $amttot=0; $taxtot=0; $total=0; while($row = mysql_fetch_array($result,MYSQL_ASSOC)) { $amttot += $row[amount]; $taxtot += $row[tax]; $total += $row[total]; $responce->rows[$i]['id']=$row[id]; $responce->rows[$i]['cell']=array($row[id],$row[invdate],$row[name],$row[amount],$row[tax],$row[total],$row[note]); $i++; } $responce->userdata['amount'] = $amttot; $responce->userdata['tax'] = $taxtot; $responce->userdata['total'] = $total; $responce->userdata['name'] = 'Totals:'; echo json_encode($responce); </XMP> </div>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/38remote5.html
HTML
art
3,724
<div style="font-size:12px;"> In this example we demonstrate the abilty to have a summary information at each group footer <br/> The appropriate options is groupSummary which enable/disable footer summary<br/> In order to work this we added two additional properties in colModel - summaryType which descripes the summary function<br/> and summaryTpl which is template on how data will be displayed into the footer column.<br/> Currently we support the following functions - sum, count, min, max. In the final release we will add a possibility to<br/> define a custom function. </div> <br /> <table id="list486"></table> <div id="plist486"></div> <script src="38array6.js" type="text/javascript"></script> <br /> <div style="font-size:12px;"> <b> HTML </b> <XMP> ... <table id="list486"></table> <div id="plist486"></div> </XMP> <b>Java Scrpt code</b> <XMP> 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"}, {id:"6",invdate:"2007-09-06",name:"test3",note:"note3",tax:"30.00",total:"430.00"}, {id:"7",invdate:"2007-10-04",name:"test",note:"note",tax:"10.00",total:"210.00"}, {id:"8",invdate:"2007-10-03",name:"test2",note:"note2",amount:"300.00",tax:"21.00",total:"320.00"}, {id:"9",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}, {id:"11",invdate:"2007-10-01",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"}, {id:"12",invdate:"2007-10-02",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"}, {id:"13",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}, {id:"14",invdate:"2007-10-04",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"}, {id:"15",invdate:"2007-10-05",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"}, {id:"16",invdate:"2007-09-06",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}, {id:"17",invdate:"2007-10-04",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"}, {id:"18",invdate:"2007-10-03",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"}, {id:"19",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}, {id:"21",invdate:"2007-10-01",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"}, {id:"22",invdate:"2007-10-02",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"}, {id:"23",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}, {id:"24",invdate:"2007-10-04",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"}, {id:"25",invdate:"2007-10-05",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"}, {id:"26",invdate:"2007-09-06",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}, {id:"27",invdate:"2007-10-04",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"}, {id:"28",invdate:"2007-10-03",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"}, {id:"29",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"} ]; jQuery("#list486").jqGrid({ data: mydata, datatype: "local", height: 'auto', rowNum: 30, rowList: [10,20,30], colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','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, editable:true}, {name:'amount',index:'amount', width:80, align:"right",sorttype:"float", formatter:"number", editable:true, summaryType:'min', summaryTpl:'<b>Min: {0}</b>'}, {name:'tax',index:'tax', width:80, align:"right",sorttype:"float",formatter:"number", editable:true, summaryType:'max', summaryTpl:'<b>Max: {0}</b>'}, {name:'total',index:'total', width:80,align:"right",sorttype:"float", formatter:"number", summaryType:'sum'}, {name:'note',index:'note', width:150, sortable:false, summaryType:'count', summaryTpl:'<b>{0} Item(s)</b>'} ], pager: "#plist486", viewrecords: true, sortname: 'name', grouping:true, groupingView : { groupField : ['name'], groupSummary : [true], groupColumnShow : [true], groupText : ['<b>{0}</b>'], groupCollapse : false, groupOrder: ['asc'] }, caption: "Summary footers" }); </XMP> </div>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/38array6.html
HTML
art
4,927
jQuery("#multiple37").jqGrid({ url:'server.jsp',//url:'localset.php', datatype: "json", height: 255, width: 600, colNames:['Index','Name', 'Code'], colModel:[ {name:'item_id',index:'item_id', width:65, sorttype:'int'}, {name:'item',index:'item', width:150,searchoptions:{sopt:['eq','cn','gt','lt'],dataInit:function(e){ $(e).addClass("a"); }}}, {name:'item_cd',index:'item_cd', width:100, searchoptions:{dataInit:function(e){ $(e).addClass("b"); }}} ], rowNum:50, rowTotal: 2000, rowList : [20,30,50], loadonce:true, mtype: "GET", rownumbers: true, rownumWidth: 40, gridview: true, pager: '#pmultiple37', sortname: 'item_id', viewrecords: true, sortorder: "asc", caption: "Multiple search on local Data" }); jQuery("#multiple37").jqGrid('navGrid','#pmultiple37',{del:false,add:false,edit:false},{},{},{},{multipleSearch:true});
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/37multiple.js
JavaScript
art
924
jQuery("#48remote4").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, sorttype:'int',summaryType:'count', summaryTpl : '({0}) total'}, {name:'invdate',index:'invdate', width:90, sorttype:'date', formatter:'date', datefmt:'d/m/Y'}, {name:'name',index:'name', width:100}, {name:'amount',index:'amount', width:80, align:"right", sorttype:'number',formatter:'number',summaryType:'sum'}, {name:'tax',index:'tax', width:80, align:"right",sorttype:'number',formatter:'number',summaryType:'sum'}, {name:'total',index:'total', width:80,align:"right",sorttype:'number',formatter:'number', summaryType:'sum'}, {name:'note',index:'note', width:150, sortable:false,editable:true} ], rowNum:10, rowList:[10,20,30], height: 'auto', pager: '#p48remote4', sortname: 'invdate', viewrecords: true, sortorder: "desc", caption:"Dynamically changing the grouping", grouping: true, groupingView : { groupField : ['name'], groupColumnShow : [true], groupText : ['<b>{0}</b>'], groupCollapse : false, groupOrder: ['asc'], groupSummary : [true], groupDataSorted : true }, footerrow: true, userDataOnFooter: true }); jQuery("#chngroup").change(function(){ var vl = $(this).val(); if(vl) { if(vl == "clear") { jQuery("#48remote4").jqGrid('groupingRemove',true); } else { jQuery("#48remote4").jqGrid('groupingGroupBy',vl); } } });
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/38remote4.js
JavaScript
art
1,622
<div style="font-size:12px;"> It is possible to load the subgrid data only once and then just to hide/show it, <br/> without to make additional ajax call to the server<br/> This is done just with one option - see the code. <br/> </div> <br /> <table id="sg3"></table> <div id="psg3"></div> <script src="40subgrid3.js" type="text/javascript"> </script> <br /> <div style="font-size:12px;"> <b> HTML </b> <XMP> ... <table id="sg3"></table> <div id="psg3"></div> ... </XMP> <b>Java Scrpt code</b> <XMP> jQuery("#sg3").jqGrid({ url:'server.php?q=1', datatype: "xml", height: 190, colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',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:8, rowList:[8,10,20,30], pager: '#psg3', sortname: 'id', viewrecords: true, sortorder: "desc", multiselect: false, subGrid: true, caption: "Custom Icons in Subgrid", // define the icons in subgrid subGridOptions: { "plusicon" : "ui-icon-triangle-1-e", "minusicon" : "ui-icon-triangle-1-s", "openicon" : "ui-icon-arrowreturn-1-e", // load the subgrid data only once // and the just show/hide "reloadOnExpand" : false, // select the row when the expand column is clicked "selectOnExpand" : true }, subGridRowExpanded: function(subgrid_id, row_id) { var subgrid_table_id, pager_id; subgrid_table_id = subgrid_id+"_t"; pager_id = "p_"+subgrid_table_id; $("#"+subgrid_id).html("<table id='"+subgrid_table_id+"' class='scroll'></table><div id='"+pager_id+"' class='scroll'></div>"); jQuery("#"+subgrid_table_id).jqGrid({ url:"subgrid.php?q=2&id="+row_id, datatype: "xml", colNames: ['No','Item','Qty','Unit','Line Total'], colModel: [ {name:"num",index:"num",width:80,key:true}, {name:"item",index:"item",width:130}, {name:"qty",index:"qty",width:70,align:"right"}, {name:"unit",index:"unit",width:70,align:"right"}, {name:"total",index:"total",width:70,align:"right",sortable:false} ], rowNum:20, pager: pager_id, sortname: 'num', sortorder: "asc", height: '100%' }); jQuery("#"+subgrid_table_id).jqGrid('navGrid',"#"+pager_id,{edit:false,add:false,del:false}) } }); jQuery("#sg3").jqGrid('navGrid','#psg3',{add:false,edit:false,del:false}); </XMP> <b>PHP with MySQL Master</b> <XMP> ... $page = $_GET['page']; // get the requested page $limit = $_GET['rows']; // get how many rows we want to have into the grid $sidx = $_GET['sidx']; // get index row - i.e. user click to sort $sord = $_GET['sord']; // get the direction if(!$sidx) $sidx =1; // connect to the database $db = mysql_connect($dbhost, $dbuser, $dbpassword) or die("Connection Error: " . mysql_error()); mysql_select_db($database) or die("Error conecting to db."); $result = mysql_query("SELECT COUNT(*) AS count FROM invheader a, clients b WHERE a.client_id=b.client_id"); $row = mysql_fetch_array($result,MYSQL_ASSOC); $count = $row['count']; if( $count >0 ) { $total_pages = ceil($count/$limit); } else { $total_pages = 0; } if ($page > $total_pages) $page=$total_pages; $start = $limit*$page - $limit; // do not put $limit*($page - 1) if ($start < 0) $start = 0; $SQL = "SELECT a.id, a.invdate, b.name, a.amount,a.tax,a.total,a.note FROM invheader a, clients b WHERE a.client_id=b.client_id ORDER BY $sidx $sord LIMIT $start , $limit"; $result = mysql_query( $SQL ) or die("Couldn’t execute query.".mysql_error()); if ( stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml") ) { header("Content-type: application/xhtml+xml;charset=utf-8"); } else { header("Content-type: text/xml;charset=utf-8"); } $et = ">"; echo "<?xml version='1.0' encoding='utf-8'?$et\n"; echo "<rows>"; echo "<page>".$page."</page>"; echo "<total>".$total_pages."</total>"; echo "<records>".$count."</records>"; // be sure to put text data in CDATA while($row = mysql_fetch_array($result,MYSQL_ASSOC)) { echo "<row id='". $row[id]."'>"; echo "<cell>". $row[id]."</cell>"; echo "<cell>". $row[invdate]."</cell>"; echo "<cell><![CDATA[". $row[name]."]]></cell>"; echo "<cell>". $row[amount]."</cell>"; echo "<cell>". $row[tax]."</cell>"; echo "<cell>". $row[total]."</cell>"; echo "<cell><![CDATA[". $row[note]."]]></cell>"; echo "</row>"; } echo "</rows>"; </XMP> <b>PHP with MySQL Subgrid</b> <XMP> $examp = $_GET["q"]; //query number $id = $_GET['id']; // connect to the database $db = mysql_connect($dbhost, $dbuser, $dbpassword) or die("Connection Error: " . mysql_error()); mysql_select_db($database) or die("Error conecting to db."); $SQL = "SELECT num, item, qty, unit FROM invlines WHERE id=".$id." ORDER BY item"; $result = mysql_query( $SQL ) or die("Couldn’t execute query.".mysql_error()); if ( stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml") ) { header("Content-type: application/xhtml+xml;charset=utf-8"); } else { header("Content-type: text/xml;charset=utf-8"); } $et = ">"; echo "<?xml version='1.0' encoding='utf-8'?$et\n"; echo "<rows>"; // be sure to put text data in CDATA while($row = mysql_fetch_array($result,MYSQL_ASSOC)) { echo "<row>"; echo "<cell>". $row[num]."</cell>"; echo "<cell><![CDATA[". $row[item]."]]></cell>"; echo "<cell>". $row[qty]."</cell>"; echo "<cell>". $row[unit]."</cell>"; echo "<cell>". number_format($row[qty]*$row[unit],2,'.',' ')."</cell>"; echo "</row>"; } echo "</rows>"; </XMP> </div>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/40subgrid3.html
HTML
art
5,899
<div style="font-size:12px;"> This example demostartes the visibility of sortable columns <br> </div> <br /> <table id="list2s"></table> <div id="pager2s"></div> <script src="sortcols.js" type="text/javascript"> </script> <br /> <div style="font-size:12px;"> <b> HTML </b> <XMP> ... <table id="list2s"></table> <div id="pager2s"></div> </XMP> <b>Java Scrpt code</b> <XMP> ... jQuery("#list2").jqGrid({ url:'server.php?q=2', datatype: "json", colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',index:'id', width:55}, {name:'invdate',index:'invdate', width:90}, {name:'name',index:'name asc, invdate', 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, rowList:[10,20,30], pager: '#pager2', sortname: 'id', viewrecords: true, sortorder: "desc", caption:"Sorting Columns Example", viewsortcols: true }).navGrid('#pager2',{edit:false,add:false,del:false}); </XMP> <b>PHP with MySQL</b> <XMP> ... $page = $_GET['page']; // get the requested page $limit = $_GET['rows']; // get how many rows we want to have into the grid $sidx = $_GET['sidx']; // get index row - i.e. user click to sort $sord = $_GET['sord']; // get the direction if(!$sidx) $sidx =1; // connect to the database $db = mysql_connect($dbhost, $dbuser, $dbpassword) or die("Connection Error: " . mysql_error()); mysql_select_db($database) or die("Error conecting to db."); $result = mysql_query("SELECT COUNT(*) AS count FROM invheader a, clients b WHERE a.client_id=b.client_id"); $row = mysql_fetch_array($result,MYSQL_ASSOC); $count = $row['count']; if( $count >0 ) { $total_pages = ceil($count/$limit); } else { $total_pages = 0; } if ($page > $total_pages) $page=$total_pages; $start = $limit*$page - $limit; // do not put $limit*($page - 1) $SQL = "SELECT a.id, a.invdate, b.name, a.amount,a.tax,a.total,a.note FROM invheader a, clients b WHERE a.client_id=b.client_id ORDER BY $sidx $sord LIMIT $start , $limit"; $result = mysql_query( $SQL ) or die("Couldn t execute query.".mysql_error()); $responce->page = $page; $responce->total = $total_pages; $responce->records = $count; $i=0; while($row = mysql_fetch_array($result,MYSQL_ASSOC)) { $responce->rows[$i]['id']=$row[id]; $responce->rows[$i]['cell']=array($row[id],$row[invdate],$row[name],$row[amount],$row[tax],$row[total],$row[note]); $i++; } echo json_encode($responce); ... </XMP> </div>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/sortcols.html
HTML
art
2,747
<div style="font-size:12px;"> This example demonstartes setting of common grid parameters. <br/> After setting this parameters a Rows and Loading messages will be changed. <br/> Reopen the grid to view this.Note that all parameters can be changed. </div> <br/> <table id="params"></table> <div id="pparams"></div> <br /> <a href="javascript:void(0)" id="pp1">Set Common Params</a> <script src="defparams.js" type="text/javascript"> </script> <br /> <br /> <div style="font-size:12px;"> <b> HTML </b> <XMP> ... <table id="params"></table> <div id="pparams"></div> <br /> <a href="javascript:void(0)" id="pp1">Set Common Params</a> <script src="defparams.js" type="text/javascript"> </script> </XMP> <b>Java Scrpt code</b> <XMP> ... jQuery("#params").jqGrid({ url:'server.php', datatype: "xml", colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',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, rowList:[10,20,30], pager: '#pparams', sortname: 'id', mtype: "POST", postData:{q:1}, viewrecords: true, sortorder: "desc", caption:"New Methods" }); jQuery("#params").jqGrid('navGrid','#pparams',{edit:false,add:false,del:false}); jQuery("#pp1").click( function() { $.extend($.jgrid.defaults,{recordtext: "{0} - {1} of {2} Record(s)",loadtext: "Processing"}); alert("New parameters are set - reopen the grid"); }); </XMP> <b>PHP with MySQL</b> <XMP> ... $page = $_GET['page']; // get the requested page $limit = $_GET['rows']; // get how many rows we want to have into the grid $sidx = $_GET['sidx']; // get index row - i.e. user click to sort $sord = $_GET['sord']; // get the direction if(!$sidx) $sidx =1; // connect to the database $db = mysql_connect($dbhost, $dbuser, $dbpassword) or die("Connection Error: " . mysql_error()); mysql_select_db($database) or die("Error conecting to db."); $result = mysql_query("SELECT COUNT(*) AS count FROM invheader a, clients b WHERE a.client_id=b.client_id"); $row = mysql_fetch_array($result,MYSQL_ASSOC); $count = $row['count']; if( $count >0 ) { $total_pages = ceil($count/$limit); } else { $total_pages = 0; } if ($page > $total_pages) $page=$total_pages; $start = $limit*$page - $limit; // do not put $limit*($page - 1) $SQL = "SELECT a.id, a.invdate, b.name, a.amount,a.tax,a.total,a.note FROM invheader a, clients b WHERE a.client_id=b.client_id ORDER BY $sidx $sord LIMIT $start , $limit"; $result = mysql_query( $SQL ) or die("Couldn’t execute query.".mysql_error()); if ( stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml") ) { header("Content-type: application/xhtml+xml;charset=utf-8"); } else { header("Content-type: text/xml;charset=utf-8"); } $et = ">"; echo "<?xml version='1.0' encoding='utf-8'?$et\n"; echo "<rows>"; echo "<page>".$page."</page>"; echo "<total>".$total_pages."</total>"; echo "<records>".$count."</records>"; // be sure to put text data in CDATA while($row = mysql_fetch_array($result,MYSQL_ASSOC)) { echo "<row id='". $row[id]."'>"; echo "<cell>". $row[id]."</cell>"; echo "<cell>". $row[invdate]."</cell>"; echo "<cell><![CDATA[". $row[name]."]]></cell>"; echo "<cell>". $row[amount]."</cell>"; echo "<cell>". $row[tax]."</cell>"; echo "<cell>". $row[total]."</cell>"; echo "<cell><![CDATA[". $row[note]."]]></cell>"; echo "</row>"; } echo "</rows>"; ... </XMP> </div>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/defparams.html
HTML
art
3,833
jQuery("#hideshow").jqGrid({ url:'server.php?q=2', datatype: "json", colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',index:'id', width:55}, {name:'invdate',index:'invdate', width:90}, {name:'name',index:'name asc, invdate', 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, rowList:[10,20,30], pager: '#phideshow', sortname: 'id', viewrecords: true, sortorder: "desc", caption:"Dynamic hide/show column groups" }); jQuery("#hideshow").jqGrid('navGrid',"#phideshow",{edit:false,add:false,del:false}); jQuery("#hcg").click( function() { jQuery("#hideshow").jqGrid('hideCol',["amount","tax"]); }); jQuery("#scg").click( function() { jQuery("#hideshow").jqGrid('showCol',["amount","tax"]); });
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/hideshow.js
JavaScript
art
1,049
jQuery("#listdnd").tableDnD({scrollAmount:0}); jQuery("#listdnd").jqGrid({ url:'server.php?q=1', datatype: "xml", colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',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, rowList:[10,20,30], pager: '#pagerdnd', sortname: 'id', viewrecords: true, sortorder: "desc", caption:"XML Example", gridComplete: function() { $("#_empty","#listdnd").addClass("nodrag nodrop"); jQuery("#listdnd").tableDnDUpdate(); }, editurl:"someurl.php" }); jQuery("#listdnd").jqGrid('navGrid','#pager1',{edit:false,add:false,del:false});
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/tablednd.js
JavaScript
art
996
<div style="font-size:12px;"> This example show the new scrolling grid feature. The data is loaded when you scroll <br> the grid. Try to scroll and see what is happen. This method can be improwed when we <br> want to load relative big data. Note the automatic disabling of pager elements. </div> <br /> <table id="scrgrid"></table> <div id="pscrgrid"></div> <script src="scrgrid.js" type="text/javascript"> </script> <br /> <div style="font-size:12px;"> <b> HTML </b> <XMP> ... <table id="jsonopt"></table> <div id="pjopt"></div> <script src="scrgrid.js" type="text/javascript"> </script> </XMP> <b>Java Scrpt code</b> <XMP> ... jQuery("#scrgrid").jqGrid({ url:'server.php?q=5', datatype: "json", colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',index:'id', width:55}, {name:'invdate',index:'invdate', width:90}, {name:'name',index:'name asc, invdate', 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:5, scroll: true, rowList:[10,20,30], pager: '#pscrgrid', sortname: 'id', viewrecords: true, sortorder: "desc", jsonReader: { repeatitems : true, cell:"", id: "0" }, caption: "Autoloading data with scroll", height: 80 }); </XMP> <b>PHP with MySQL</b> <XMP> ... $page = $_GET['page']; // get the requested page $limit = $_GET['rows']; // get how many rows we want to have into the grid $sidx = $_GET['sidx']; // get index row - i.e. user click to sort $sord = $_GET['sord']; // get the direction if(!$sidx) $sidx =1; // connect to the database $db = mysql_connect($dbhost, $dbuser, $dbpassword) or die("Connection Error: " . mysql_error()); mysql_select_db($database) or die("Error conecting to db."); $result = mysql_query("SELECT COUNT(*) AS count FROM invheader a, clients b WHERE a.client_id=b.client_id"); $row = mysql_fetch_array($result,MYSQL_ASSOC); $count = $row['count']; if( $count >0 ) { $total_pages = ceil($count/$limit); } else { $total_pages = 0; } if ($page > $total_pages) $page=$total_pages; $start = $limit*$page - $limit; // do not put $limit*($page - 1) if ($start<0) $start = 0; $SQL = "SELECT a.id, a.invdate, b.name, a.amount,a.tax,a.total,a.note FROM invheader a, clients b WHERE a.client_id=b.client_id ORDER BY $sidx $sord LIMIT $start , $limit"; $result = mysql_query( $SQL ) or die("Couldn’t execute query.".mysql_error()); $responce->page = $page; $responce->total = $total_pages; $responce->records = $count; $i=0; while($row = mysql_fetch_array($result,MYSQL_ASSOC)) { $responce->rows[$i]=$responce->rows[$i]['cell']=array($row[id],$row[invdate],$row[name],$row[amount],$row[tax],$row[total],$row[note]); $i++; } echo $json->encode($responce); // coment if php 5 //echo json_encode($responce); ... </XMP> </div>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/scrgrid.html
HTML
art
3,086
jQuery("#toolbar1").jqGrid({ url:'server.php?q=1', datatype: "xml", colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',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, rowList:[10,20,30], pager: '#pgtoolbar1', sortname: 'id', viewrecords: true, sortorder: "desc", caption:"Toolbar Example", editurl:"someurl.php", toolbar: [true,"top"] }); jQuery("#toolbar1").jqGrid('navGrid','#pgtoolbar1',{edit:false,add:false,del:false}); $("#t_toolbar1").append("<input type='button' value='Click Me' style='height:20px;font-size:-3'/>"); $("input","#t_toolbar1").click(function(){ alert("Hi! I'm added button at this toolbar"); }); jQuery("#toolbar2").jqGrid({ url:'server.php?q=1', datatype: "xml", colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',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, rowList:[10,20,30], pager: '#pgtoolbar2', sortname: 'id', viewrecords: true, sortorder: "desc", caption:"User Data Example", editurl:"someurl.php", toolbar: [true,"bottom"], loadComplete: function() { var udata = $("#toolbar2").jqGrid('getUserData'); $("#t_toolbar2").css("text-align","right").html("Totals Amount:"+udata.tamount+" Tax: "+udata.ttax+" Total: "+udata.ttotal+ "&nbsp;&nbsp;&nbsp;"); } }); jQuery("#toolbar2").jqGrid('navGrid','#pgtoolbar2',{edit:false,add:false,del:false});
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/toolbar.js
JavaScript
art
2,190
jQuery("#setcols").jqGrid({ url:'server.php?q=2', datatype: "json", colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',index:'id', width:55,hidedlg:true}, {name:'invdate',index:'invdate', width:90,editable:true}, {name:'name',index:'name asc, invdate', width:100}, {name:'amount',index:'amount', width:80, align:"right",editable:true,editrules:{number:true}}, {name:'tax',index:'tax', width:80, align:"right",editable:true,editrules:{number:true}}, {name:'total',index:'total', width:80,align:"right"}, {name:'note',index:'note', width:150, sortable:false} ], rowNum:10, rowList:[10,20,30], pager: '#psetcols', sortname: 'id', viewrecords: true, sortorder: "desc" }); jQuery("#setcols").jqGrid('navGrid','#pgwidth',{edit:false,add:false,del:false}); jQuery("#vcol").click(function (){ jQuery("#setcols").jqGrid('setColumns'); });
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/setcolumns.js
JavaScript
art
978
<div style="font-size:12px;"> We can change the icons of the subgrid. This is done with the option of the subgrid,<br/> which point to a icon of Theme roller. </div> <br /> <table id="sg1"></table> <div id="psg1"></div> <script src="40subgrid1.js" type="text/javascript"> </script> <br /> <div style="font-size:12px;"> <b> HTML </b> <XMP> ... <table id="sg1"></table> <div id="psg1"></div> ... </XMP> <b>Java Scrpt code</b> <XMP> jQuery("#sg1").jqGrid({ url:'server.php?q=1', datatype: "xml", height: 190, colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',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:8, rowList:[8,10,20,30], pager: '#psg1', sortname: 'id', viewrecords: true, sortorder: "desc", multiselect: false, subGrid: true, caption: "Custom Icons in Subgrid", // define the icons in subgrid subGridOptions: { "plusicon" : "ui-icon-triangle-1-e", "minusicon" : "ui-icon-triangle-1-s", "openicon" : "ui-icon-arrowreturn-1-e" }, subGridRowExpanded: function(subgrid_id, row_id) { var subgrid_table_id, pager_id; subgrid_table_id = subgrid_id+"_t"; pager_id = "p_"+subgrid_table_id; $("#"+subgrid_id).html("<table id='"+subgrid_table_id+"' class='scroll'></table><div id='"+pager_id+"' class='scroll'></div>"); jQuery("#"+subgrid_table_id).jqGrid({ url:"subgrid.php?q=2&id="+row_id, datatype: "xml", colNames: ['No','Item','Qty','Unit','Line Total'], colModel: [ {name:"num",index:"num",width:80,key:true}, {name:"item",index:"item",width:130}, {name:"qty",index:"qty",width:70,align:"right"}, {name:"unit",index:"unit",width:70,align:"right"}, {name:"total",index:"total",width:70,align:"right",sortable:false} ], rowNum:20, pager: pager_id, sortname: 'num', sortorder: "asc", height: '100%' }); jQuery("#"+subgrid_table_id).jqGrid('navGrid',"#"+pager_id,{edit:false,add:false,del:false}) } }); jQuery("#sg1").jqGrid('navGrid','#psg1',{add:false,edit:false,del:false}); </XMP> <b>PHP with MySQL Master</b> <XMP> ... $page = $_GET['page']; // get the requested page $limit = $_GET['rows']; // get how many rows we want to have into the grid $sidx = $_GET['sidx']; // get index row - i.e. user click to sort $sord = $_GET['sord']; // get the direction if(!$sidx) $sidx =1; // connect to the database $db = mysql_connect($dbhost, $dbuser, $dbpassword) or die("Connection Error: " . mysql_error()); mysql_select_db($database) or die("Error conecting to db."); $result = mysql_query("SELECT COUNT(*) AS count FROM invheader a, clients b WHERE a.client_id=b.client_id"); $row = mysql_fetch_array($result,MYSQL_ASSOC); $count = $row['count']; if( $count >0 ) { $total_pages = ceil($count/$limit); } else { $total_pages = 0; } if ($page > $total_pages) $page=$total_pages; $start = $limit*$page - $limit; // do not put $limit*($page - 1) if ($start < 0) $start = 0; $SQL = "SELECT a.id, a.invdate, b.name, a.amount,a.tax,a.total,a.note FROM invheader a, clients b WHERE a.client_id=b.client_id ORDER BY $sidx $sord LIMIT $start , $limit"; $result = mysql_query( $SQL ) or die("Couldn’t execute query.".mysql_error()); if ( stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml") ) { header("Content-type: application/xhtml+xml;charset=utf-8"); } else { header("Content-type: text/xml;charset=utf-8"); } $et = ">"; echo "<?xml version='1.0' encoding='utf-8'?$et\n"; echo "<rows>"; echo "<page>".$page."</page>"; echo "<total>".$total_pages."</total>"; echo "<records>".$count."</records>"; // be sure to put text data in CDATA while($row = mysql_fetch_array($result,MYSQL_ASSOC)) { echo "<row id='". $row[id]."'>"; echo "<cell>". $row[id]."</cell>"; echo "<cell>". $row[invdate]."</cell>"; echo "<cell><![CDATA[". $row[name]."]]></cell>"; echo "<cell>". $row[amount]."</cell>"; echo "<cell>". $row[tax]."</cell>"; echo "<cell>". $row[total]."</cell>"; echo "<cell><![CDATA[". $row[note]."]]></cell>"; echo "</row>"; } echo "</rows>"; </XMP> <b>PHP with MySQL Subgrid</b> <XMP> $examp = $_GET["q"]; //query number $id = $_GET['id']; // connect to the database $db = mysql_connect($dbhost, $dbuser, $dbpassword) or die("Connection Error: " . mysql_error()); mysql_select_db($database) or die("Error conecting to db."); $SQL = "SELECT num, item, qty, unit FROM invlines WHERE id=".$id." ORDER BY item"; $result = mysql_query( $SQL ) or die("Couldn’t execute query.".mysql_error()); if ( stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml") ) { header("Content-type: application/xhtml+xml;charset=utf-8"); } else { header("Content-type: text/xml;charset=utf-8"); } $et = ">"; echo "<?xml version='1.0' encoding='utf-8'?$et\n"; echo "<rows>"; // be sure to put text data in CDATA while($row = mysql_fetch_array($result,MYSQL_ASSOC)) { echo "<row>"; echo "<cell>". $row[num]."</cell>"; echo "<cell><![CDATA[". $row[item]."]]></cell>"; echo "<cell>". $row[qty]."</cell>"; echo "<cell>". $row[unit]."</cell>"; echo "<cell>". number_format($row[qty]*$row[unit],2,'.',' ')."</cell>"; echo "</row>"; } echo "</rows>"; </XMP> </div>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/40subgrid1.html
HTML
art
5,627
<div style="font-size:12px;"> A Form editing module changes a lot adding very usefull features. Thanks to Faserline <code>www.faserline.com</code><br/> Here we demonstrate the following features: <br/> closeOnEscape, modal which cover only the grid, a new gridView method, changing the labels of the fields,<br/> changing the row positions, adding prefixes and sufixes in the fields, set default values in add mode,<br/> retrieve a selects via url, attaching easy a date picker, set default value via function, adding additional information at the bottom or top of the form </div> <br /> <table id="navgrid3"></table> <div id="pagernav3"></div> <script src="navgrid3.js" type="text/javascript"> </script> <br /><br /> <div style="font-size:12px;"> <b> Description </b> <br /> This method uses <b>colModel</b> and <b>editurl</b> parameters from jqGrid <br/> <code> Calling: jQuery("#grid_id").jqGrid('navGrid',selector,options,pEdit,pAdd,pDel,pSearch ); </code> <br/> </XMP> <b>Java Scrpt code</b> <XMP> jQuery("#navgrid3").jqGrid({ url:'editing.php?q=1', datatype: "xml", 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:12, dataInit:function(el){ $(el).datepicker({dateFormat:'yy-mm-dd'}); }, defaultValue: function(){ var currentTime = new Date(); var month = parseInt(currentTime.getMonth() + 1); month = month <= 9 ? "0"+month : month; var day = currentTime.getDate(); day = day <= 9 ? "0"+day : day; var year = currentTime.getFullYear(); return year+"-"+month + "-"+day; } }, formoptions:{ rowpos:2, elmprefix:"(*)",elmsuffix:" yyyy-mm-dd" }, editrules:{required:true} }, {name:'name',index:'name', width:90,editable:true,editoptions:{size:25}, formoptions:{ rowpos:1, label: "Name", elmprefix:"(*)"},editrules:{required:true}}, {name:'amount',index:'amount', width:60, align:"right",editable:true,editoptions:{size:10}, formoptions:{ rowpos:5,elmprefix:"&nbsp;&nbsp;&nbsp;&nbsp;"}}, {name:'tax',index:'tax', width:60, align:"right",editable:true,editoptions:{size:10},formoptions:{ rowpos:6,elmprefix:"&nbsp;&nbsp;&nbsp;&nbsp;"}}, {name:'total',index:'total', width:60,align:"right",editable:true,editoptions:{size:10}, formoptions:{ rowpos:7,elmprefix:"&nbsp;&nbsp;&nbsp;&nbsp;" }}, {name:'closed',index:'closed',width:55,align:'center',editable:true,edittype:"checkbox",editoptions:{value:"Yes:No",defaultValue:"Yes"}, formoptions:{ rowpos:4,elmprefix:"&nbsp;&nbsp;&nbsp;&nbsp;" }}, {name:'ship_via',index:'ship_via',width:70, editable: true, edittype:"select", editoptions:{dataUrl:'test.txt', defaultValue:'Intime'}, formoptions:{ rowpos:3,elmprefix:"&nbsp;&nbsp;&nbsp;&nbsp;" } }, {name:'note',index:'note', width:100, sortable:false,editable: true,edittype:"textarea", editoptions:{rows:"2",cols:"20"}, formoptions:{ rowpos:8,elmprefix:"&nbsp;&nbsp;&nbsp;&nbsp;" }} ], rowNum:10, rowList:[10,20,30], pager: '#pagernav3', sortname: 'id', viewrecords: true, sortorder: "desc", caption:"Navigator Example", editurl:"someurl.php", height:210 }); jQuery("#navgrid3").jqGrid('navGrid','#pagernav3', {view:true}, //options {height:290,reloadAfterSubmit:false, jqModal:false, closeOnEscape:true, bottominfo:"Fields marked with (*) are required"}, // edit options {height:290,reloadAfterSubmit:false,jqModal:false, closeOnEscape:true,bottominfo:"Fields marked with (*) are required", closeAfterAdd: true}, // add options {reloadAfterSubmit:false,jqModal:false, closeOnEscape:true}, // del options {closeOnEscape:true}, // search options {height:250,jqModal:false,closeOnEscape:true} // view options ); </XMP> </div>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/navgrid3.html
HTML
art
4,026
<div style="font-size:12px;"> This example demonstrates dynamic resizing of grid. It is known that <br> the width of grid is sum of the width of the columns. We can overwrite<br> this by setting the grid width. In this case the column width are <br> scaled to the new width.<br> With setting the height to 100% we can scale the height of the grid.<br> Try to go on next page. </div> <br /> <table id="list12"></table> <div id="pager12"></div> <script src="resizeex.js" type="text/javascript"> </script> <br /> <br /> <div style="font-size:12px;"> <b> HTML </b> <XMP> ... <table id="list12"></table> <div id="pager12"></div> </XMP> <b>Java Scrpt code</b> <XMP> ... jQuery("#list12").jqGrid({ url:'server.php?q=2', datatype: "json", colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',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, rowList:[10,20,30], pager: '#pager12', sortname: 'id', viewrecords: true, sortorder: "desc", multiselect: false, width: 500, height: "100%", caption: "Auto height example" }); jQuery("#list12").jqGrid('navGrid','#pager12',{add:false,edit:false,del:false}); </XMP> <b>PHP with MySQL</b> <XMP> ... $page = $_GET['page']; // get the requested page $limit = $_GET['rows']; // get how many rows we want to have into the grid $sidx = $_GET['sidx']; // get index row - i.e. user click to sort $sord = $_GET['sord']; // get the direction if(!$sidx) $sidx =1; // connect to the database $db = mysql_connect($dbhost, $dbuser, $dbpassword) or die("Connection Error: " . mysql_error()); mysql_select_db($database) or die("Error conecting to db."); $result = mysql_query("SELECT COUNT(*) AS count FROM invheader a, clients b WHERE a.client_id=b.client_id"); $row = mysql_fetch_array($result,MYSQL_ASSOC); $count = $row['count']; if( $count >0 ) { $total_pages = ceil($count/$limit); } else { $total_pages = 0; } if ($page > $total_pages) $page=$total_pages; $start = $limit*$page - $limit; // do not put $limit*($page - 1) $SQL = "SELECT a.id, a.invdate, b.name, a.amount,a.tax,a.total,a.note FROM invheader a, clients b WHERE a.client_id=b.client_id ORDER BY $sidx $sord LIMIT $start , $limit"; $result = mysql_query( $SQL ) or die("Couldn t execute query.".mysql_error()); $responce->page = $page; $responce->total = $total_pages; $responce->records = $count; $i=0; while($row = mysql_fetch_array($result,MYSQL_ASSOC)) { $responce->rows[$i]['id']=$row[id]; $responce->rows[$i]['cell']=array($row[id],$row[invdate],$row[name],$row[amount],$row[tax],$row[total],$row[note]); $i++; } echo json_encode($responce); ... </XMP> </div>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/resizeex.html
HTML
art
3,083
jQuery("#list15").jqGrid({ url:'server.php?q=2', datatype: "json", colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',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, rowList:[10,20,30], pager: '#pager15', sortname: 'id', viewrecords: true, sortorder: "desc", loadComplete: function(){ var ret; alert("This function is executed immediately after\n data is loaded. We try to update data in row 13."); ret = jQuery("#list15").jqGrid('getRowData',"13"); if(ret.id == "13"){ jQuery("#list15").jqGrid('setRowData',ret.id,{note:"<font color='red'>Row 13 is updated!</font>"}) } } }); jQuery("#sids").click( function() { alert("Id's of Grid: \n"+jQuery("#list15").jqGrid('getDataIDs')); });
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/loadcml.js
JavaScript
art
1,149
var lastsel; jQuery("#rowed3").jqGrid({ url:'server.php?q=2', datatype: "json", colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',index:'id', width:55}, {name:'invdate',index:'invdate', width:90, editable:true}, {name:'name',index:'name', width:100,editable:true}, {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} ], rowNum:10, rowList:[10,20,30], pager: '#prowed3', sortname: 'id', viewrecords: true, sortorder: "desc", onSelectRow: function(id){ if(id && id!==lastsel){ jQuery('#rowed3').jqGrid('restoreRow',lastsel); jQuery('#rowed3').jqGrid('editRow',id,true); lastsel=id; } }, editurl: "server.php", caption: "Using events example" }); jQuery("#rowed3").jqGrid('navGrid',"#prowed3",{edit:false,add:false,del:false});
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/rowedex3.js
JavaScript
art
1,117
<div style="font-size:12px;"> This example show how we can load data once from Server. Note that in this case pager is disabled. </div> <br /> <table id="list3"></table> <div id="pager3"></div> <script src="loadoncex.js" type="text/javascript"></script> <br /> <div style="font-size:12px;"> <b> HTML </b> <XMP> ... <table id="list3"></table> <div id="pager3"></div> </XMP> <b>Java Scrpt code</b> <XMP> ... jQuery("#list3").jqGrid({ url:'server.php?q=2', datatype: "json", colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',index:'id', width:60, sorttype:"int"}, {name:'invdate',index:'invdate', width:90, sorttype:"date"}, {name:'name',index:'name', width:100}, {name:'amount',index:'amount', width:80, align:"right",sorttype:"float"}, {name:'tax',index:'tax', width:80, align:"right",sorttype:"float"}, {name:'total',index:'total', width:80,align:"right",sorttype:"float"}, {name:'note',index:'note', width:150, sortable:false} ], rowNum:20, rowList:[10,20,30], pager: '#pager3', sortname: 'id', viewrecords: true, sortorder: "desc", loadonce: true, caption: "Load Once Example" }); </XMP> <b>PHP with MySQL</b> <XMP> ... $page = $_GET['page']; // get the requested page $limit = $_GET['rows']; // get how many rows we want to have into the grid $sidx = $_GET['sidx']; // get index row - i.e. user click to sort $sord = $_GET['sord']; // get the direction if(!$sidx) $sidx =1; // connect to the database $db = mysql_connect($dbhost, $dbuser, $dbpassword) or die("Connection Error: " . mysql_error()); mysql_select_db($database) or die("Error conecting to db."); $result = mysql_query("SELECT COUNT(*) AS count FROM invheader a, clients b WHERE a.client_id=b.client_id"); $row = mysql_fetch_array($result,MYSQL_ASSOC); $count = $row['count']; if( $count >0 ) { $total_pages = ceil($count/$limit); } else { $total_pages = 0; } if ($page > $total_pages) $page=$total_pages; $start = $limit*$page - $limit; // do not put $limit*($page - 1) $SQL = "SELECT a.id, a.invdate, b.name, a.amount,a.tax,a.total,a.note FROM invheader a, clients b WHERE a.client_id=b.client_id ORDER BY $sidx $sord LIMIT $start , $limit"; $result = mysql_query( $SQL ) or die("Couldn t execute query.".mysql_error()); $responce->page = $page; $responce->total = $total_pages; $responce->records = $count; $i=0; while($row = mysql_fetch_array($result,MYSQL_ASSOC)) { $responce->rows[$i]['id']=$row[id]; $responce->rows[$i]['cell']=array($row[id],$row[invdate],$row[name],$row[amount],$row[tax],$row[total],$row[note]); $i++; } echo json_encode($responce); ... </XMP> </div>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/loadoncex.html
HTML
art
2,792
jQuery("#list7").jqGrid({ url:'server.php?q=2', datatype: "json", colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',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, rowList:[10,20,30], pager: '#pager7', sortname: 'id', viewrecords: true, sortorder: "desc", caption:"Set Methods Example", hidegrid: false, height: 210 }); jQuery("#list7").jqGrid('navGrid','#pager7',{edit:false,add:false,del:false,refresh:false,searchtext:"Find"}); jQuery("#s1").click( function() { jQuery("#list7").jqGrid('setGridParam',{url:"server.php?q=2"}).trigger("reloadGrid") }); jQuery("#s2").click( function() { jQuery("#list7").jqGrid('setGridParam',{sortname:"amount",sortorder:"asc"}).trigger("reloadGrid"); }); jQuery("#s3").click( function() { var so = jQuery("#list7").jqGrid('getGridParam','sortorder'); so = so=="asc"?"desc":"asc"; jQuery("#list7").jqGrid('setGridParam',{sortorder:so}).trigger("reloadGrid"); }); jQuery("#s4").click( function() { jQuery("#list7").jqGrid('setGridParam',{page:2}).trigger("reloadGrid"); }); jQuery("#s5").click( function() { jQuery("#list7").jqGrid('setGridParam',{rowNum:15}).trigger("reloadGrid"); }); jQuery("#s6").click( function() { jQuery("#list7").jqGrid('setGridParam',{url:"server.php?q=1",datatype:"xml"}).trigger("reloadGrid"); }); jQuery("#s7").click( function() { jQuery("#list7").jqGrid('setCaption',"New Caption"); }); jQuery("#s8").click( function() { jQuery("#list7").jqGrid('sortGrid',"name",false); });
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/setex.js
JavaScript
art
1,925
jQuery("#rowed1").jqGrid({ url:'server.php?q=2', datatype: "json", colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',index:'id', width:55}, {name:'invdate',index:'invdate', width:90, editable:true}, {name:'name',index:'name', width:100,editable:true}, {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} ], rowNum:10, rowList:[10,20,30], pager: '#prowed1', sortname: 'id', viewrecords: true, sortorder: "desc", editurl: "server.php", caption: "Basic Example" }); jQuery("#rowed1").jqGrid('navGrid',"#prowed1",{edit:false,add:false,del:false}); jQuery("#ed1").click( function() { jQuery("#rowed1").jqGrid('editRow',"13"); this.disabled = 'true'; jQuery("#sved1,#cned1").attr("disabled",false); }); jQuery("#sved1").click( function() { jQuery("#rowed1").jqGrid('saveRow',"13"); jQuery("#sved1,#cned1").attr("disabled",true); jQuery("#ed1").attr("disabled",false); }); jQuery("#cned1").click( function() { jQuery("#rowed1").jqGrid('restoreRow',"13"); jQuery("#sved1,#cned1").attr("disabled",true); jQuery("#ed1").attr("disabled",false); });
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/rowedex1.js
JavaScript
art
1,433
jQuery("#list5").jqGrid({ url:'server.php?q=2', datatype: "json", colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',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, rowList:[10,20,30], pager: '#pager5', sortname: 'id', viewrecords: true, sortorder: "desc", caption:"Simple data manipulation", editurl:"someurl.php" }); jQuery("#list5").jqGrid('navGrid',"#pager5",{edit:false,add:false,del:false}); jQuery("#a1").click( function(){ var id = jQuery("#list5").jqGrid('getGridParam','selrow'); if (id) { var ret = jQuery("#list5").jqGrid('getRowData',id); alert("id="+ret.id+" invdate="+ret.invdate+"..."); } else { alert("Please select row");} }); jQuery("#a2").click( function(){ var su=jQuery("#list5").jqGrid('delRowData',12); if(su) alert("Succes. Write custom code to delete row from server"); else alert("Allready deleted or not in list"); }); jQuery("#a3").click( function(){ var su=jQuery("#list5").jqGrid('setRowData',11,{amount:"333.00",tax:"33.00",total:"366.00",note:"<img src='images/user1.gif'/>"}); if(su) alert("Succes. Write custom code to update row in server"); else alert("Can not update"); }); jQuery("#a4").click( function(){ var datarow = {id:"99",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}; var su=jQuery("#list5").jqGrid('addRowData',99,datarow); if(su) alert("Succes. Write custom code to add data in server"); else alert("Can not update"); });
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/manipex.js
JavaScript
art
1,900
jQuery("#gwidth").jqGrid({ url:'server.php?q=2', datatype: "json", colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',index:'id', width:55}, {name:'invdate',index:'invdate', width:90}, {name:'name',index:'name asc, invdate', 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, rowList:[10,20,30], pager: '#pgwidth', sortname: 'id', viewrecords: true, sortorder: "desc", caption:"Dynamic height/width Example", forceFit : true, onSortCol :function (nm,index) { if (nm=='invdate') { jQuery("#gwidth").jqGrid('setGridParam',{sortname:'name'}); } }, onHeaderClick: function (status){ alert("My status is now: "+ status); } }); jQuery("#gwidth").jqGrid('navGrid','#pgwidth',{edit:false,add:false,del:false}); jQuery("#snw").click(function (){ var nw = parseInt(jQuery("#setwidth").val()); if(isNaN(nw)) { alert("Value must be a number"); } else if (nw<200 || nw > 700) { alert("Value can be between 200 and 700") } else { jQuery("#gwidth").jqGrid('setGridWidth',nw); } }); jQuery("#snh").click(function (){ var nh = jQuery("#setheight").val(); jQuery("#gwidth").jqGrid('setGridHeight',nh); });
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/gridwidth.js
JavaScript
art
1,478
<div style="font-size:12px;"> This example demonstartes the new option hiddengrid. If set to true the grid initially is hidden. The data is not loaded <br/> (no request is made) and only the caption layer is shown. When click to show grid (first time only) <br/> the data is loaded and grid is shown. From this point we have a regular grid. This option work <br/> only if the caption option is set and hidegrid option is set to true. Try to click on caption button. </div> <br/> <br/> <table id="hidengrid"></table> <div id="phidengrid"></div> <script src="hiddengrid.js" type="text/javascript"> </script> <br /> <br /> <div style="font-size:12px;"> <b> HTML </b> <XMP> ... <table id="hidengrid"></table> <div id="phidengrid"></div> <script src="hiddengrid.js" type="text/javascript"> </script> </XMP> <b>Java Scrpt code</b> <XMP> ... jQuery("#hidengrid").jqGrid({ url:'server.php?q=1', datatype: "xml", colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',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, rowList:[10,20,30], pager: '#phidengrid', sortname: 'id', viewrecords: true, sortorder: "desc", caption:"Initial Hidden Grid", multiselect: false, hiddengrid: true }); jQuery("#hidengrid").jqGrid('navGrid','#phidengrid',{edit:false,add:false,del:false}); </XMP> <b>PHP with MySQL</b> <XMP> ... $page = $_GET['page']; // get the requested page $limit = $_GET['rows']; // get how many rows we want to have into the grid $sidx = $_GET['sidx']; // get index row - i.e. user click to sort $sord = $_GET['sord']; // get the direction if(!$sidx) $sidx =1; // connect to the database $db = mysql_connect($dbhost, $dbuser, $dbpassword) or die("Connection Error: " . mysql_error()); mysql_select_db($database) or die("Error conecting to db."); $result = mysql_query("SELECT COUNT(*) AS count FROM invheader a, clients b WHERE a.client_id=b.client_id"); $row = mysql_fetch_array($result,MYSQL_ASSOC); $count = $row['count']; if( $count >0 ) { $total_pages = ceil($count/$limit); } else { $total_pages = 0; } if ($page > $total_pages) $page=$total_pages; $start = $limit*$page - $limit; // do not put $limit*($page - 1) $SQL = "SELECT a.id, a.invdate, b.name, a.amount,a.tax,a.total,a.note FROM invheader a, clients b WHERE a.client_id=b.client_id ORDER BY $sidx $sord LIMIT $start , $limit"; $result = mysql_query( $SQL ) or die("Couldn’t execute query.".mysql_error()); if ( stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml") ) { header("Content-type: application/xhtml+xml;charset=utf-8"); } else { header("Content-type: text/xml;charset=utf-8"); } $et = ">"; echo "<?xml version='1.0' encoding='utf-8'?$et\n"; echo "<rows>"; echo "<page>".$page."</page>"; echo "<total>".$total_pages."</total>"; echo "<records>".$count."</records>"; // be sure to put text data in CDATA while($row = mysql_fetch_array($result,MYSQL_ASSOC)) { echo "<row id='". $row[id]."'>"; echo "<cell>". $row[id]."</cell>"; echo "<cell>". $row[invdate]."</cell>"; echo "<cell><![CDATA[". $row[name]."]]></cell>"; echo "<cell>". $row[amount]."</cell>"; echo "<cell>". $row[tax]."</cell>"; echo "<cell>". $row[total]."</cell>"; echo "<cell><![CDATA[". $row[note]."]]></cell>"; echo "</row>"; } echo "</rows>"; ... </XMP> </div>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/hiddengrid.html
HTML
art
3,772
<div style="font-size:12px;"> We can have a full control on what is done at server side when we save the data. <br> It is well known that the post can be successful, but the same saving to the database can be not.<br> To control that we can use a callback function when data is saving to the server.<br> The function accept one parameter - data returned from the server. Depending on this data<br> the function should return true or false. When true this means the saving is done and false othewise.<br> In our case the save is missing, since the server return nothing. </div> <br /> <table id="rowed4"></table> <div id="prowed4"></div> <br /> <input type="BUTTON" id="ed4" value="Edit row 13" /> <input type="BUTTON" id="sved4" disabled='true' value="Save row 13" /> <script src="rowedex4.js" type="text/javascript"> </script> <br /> <br /> <div style="font-size:12px;"> <b> HTML </b> <XMP> ... <table id="rowed4"></table> <div id="prowed4"></div> <br /> <input type="BUTTON" id="ed4" value="Edit row 13" /> <input type="BUTTON" id="sved4" disabled='true' value="Save row 13" /> <script src="rowedex4.js" type="text/javascript"> </script> </XMP> <b>Java Scrpt code</b> <XMP> ... jQuery("#rowed4").jqGrid({ url:'server.php?q=2', datatype: "json", colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',index:'id', width:55}, {name:'invdate',index:'invdate', width:90, editable:true}, {name:'name',index:'name', width:100,editable:true}, {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} ], rowNum:10, rowList:[10,20,30], pager: '#prowed4', sortname: 'id', viewrecords: true, sortorder: "desc", editurl: "server.php", caption: "Full control" }); jQuery("#ed4").click( function() { jQuery("#rowed4").jqGrid('editRow',"13"); this.disabled = 'true'; jQuery("#sved4").attr("disabled",false); }); jQuery("#sved4").click( function() { jQuery("#rowed4").jqGrid('saveRow',"13", checksave); jQuery("#sved4").attr("disabled",true); jQuery("#ed4").attr("disabled",false); }); function checksave(result) { if (result.responseText=="") {alert("Update is missing!"); return false;} return true; } </XMP> <b>PHP with MySQL</b> <XMP> ... $page = $_GET['page']; // get the requested page $limit = $_GET['rows']; // get how many rows we want to have into the grid $sidx = $_GET['sidx']; // get index row - i.e. user click to sort $sord = $_GET['sord']; // get the direction if(!$sidx) $sidx =1; // connect to the database $db = mysql_connect($dbhost, $dbuser, $dbpassword) or die("Connection Error: " . mysql_error()); mysql_select_db($database) or die("Error conecting to db."); $result = mysql_query("SELECT COUNT(*) AS count FROM invheader a, clients b WHERE a.client_id=b.client_id"); $row = mysql_fetch_array($result,MYSQL_ASSOC); $count = $row['count']; if( $count >0 ) { $total_pages = ceil($count/$limit); } else { $total_pages = 0; } if ($page > $total_pages) $page=$total_pages; $start = $limit*$page - $limit; // do not put $limit*($page - 1) $SQL = "SELECT a.id, a.invdate, b.name, a.amount,a.tax,a.total,a.note FROM invheader a, clients b WHERE a.client_id=b.client_id ORDER BY $sidx $sord LIMIT $start , $limit"; $result = mysql_query( $SQL ) or die("Couldn t execute query.".mysql_error()); $responce->page = $page; $responce->total = $total_pages; $responce->records = $count; $i=0; while($row = mysql_fetch_array($result,MYSQL_ASSOC)) { $responce->rows[$i]['id']=$row[id]; $responce->rows[$i]['cell']=array($row[id],$row[invdate],$row[name],$row[amount],$row[tax],$row[total],$row[note]); $i++; } echo json_encode($responce); ... </XMP> </div>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/rowedex4.html
HTML
art
4,034
/* jQuery("#single").jqGrid({ url:'localset.php', datatype: "json", height: 255, width: 600, colNames:['Index','Name', 'Code'], colModel:[ {name:'item_id',index:'item_id', width:65, sorttype:'int'}, {name:'item',index:'item', width:150}, {name:'item_cd',index:'item_cd', width:100} ], rowNum:50, rowTotal: 2000, rowList : [20,30,50], loadonce:true, mtype: "GET", rownumbers: true, rownumWidth: 40, gridview: true, pager: '#psingle', sortname: 'item_id', viewrecords: true, sortorder: "asc", caption: "Single search on local data" }); jQuery("#single").jqGrid('navGrid','#psingle',{del:false,add:false,edit:false}); */ $("#single").jqGrid({ url: 'server.json', datatype: "json", height: 340, colNames: ['DataType', 'KeyWords', 'DoTime', 'DataCount', 'SiteCount'], colModel: [ { name: 'DataType', index: 'DataType', width: '15%', sortable: false, align: 'center' }, { name: 'KeyWords', index: 'KeyWords', width: '50%', sortable: false, align: 'left' }, { name: 'DoTime', index: 'DoTime', width: '20%', align: 'center'}, { name: 'DataCount', index: 'DataCount', width: '15%', align: 'center', sorttype: 'int' }, { name: 'SiteCount', index: 'SiteCount', width: '0%', hidden: true,sortable: false} ], jsonReader: { repeatitems: false }, loadui: 'block', viewrecords: true, autowidth: true, pagerpos: 'center', rowNum: 20, rowList: [10, 20, 30], pgtext: "s {0} from {1} s", recordtext: 's {0} – {1} sss {2} fff', emptyrecords: 'empty', pager: "#psingle", onPaging: function(which_button) { $("#single").jqGrid('setGridParam',{ datatype: 'json' }); }, loadError: function(xhr, status, error) { }, loadComplete: function() { $("#single").jqGrid('setGridParam',{ datatype: 'local' }); } }).jqGrid('navGrid', '#single', { search: false, edit: false, add: false, del: false });
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/37single.js
JavaScript
art
2,189
<div style="font-size:12px;"> This example demonstrates using a subgrid.<br> <del><b>Note:</b> Currently subgrid can work only with xml data. Json is in progress.</del> </div> <br /> <table id="list11"></table> <div id="pager11"></div> <script src="subgrid.js" type="text/javascript"> </script> <br /> <div style="font-size:12px;"> <b> HTML </b> <XMP> ... <<table id="list11"></table> <div id="pager11"></div> <script src="subgrid.js" type="text/javascript"> </script> </XMP> <b>Java Scrpt code</b> <XMP> ... jQuery("#list11").jqGrid({ url:'server.php?q=1', datatype: "xml", height: 200, colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',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, rowList:[10,20,30], pager: '#pager11', sortname: 'id', viewrecords: true, sortorder: "desc", multiselect: false, subGrid : true, subGridUrl: 'subgrid.php?q=2', subGridModel: [{ name : ['No','Item','Qty','Unit','Line Total'], width : [55,200,80,80,80] } ], caption: "Subgrid Example" }); jQuery("#list11").jqGrid('navGrid','#pager11',{add:false,edit:false,del:false}); </XMP> <b>PHP with MySQL Master</b> <XMP> ... $page = $_GET['page']; // get the requested page $limit = $_GET['rows']; // get how many rows we want to have into the grid $sidx = $_GET['sidx']; // get index row - i.e. user click to sort $sord = $_GET['sord']; // get the direction if(!$sidx) $sidx =1; // connect to the database $db = mysql_connect($dbhost, $dbuser, $dbpassword) or die("Connection Error: " . mysql_error()); mysql_select_db($database) or die("Error conecting to db."); $result = mysql_query("SELECT COUNT(*) AS count FROM invheader a, clients b WHERE a.client_id=b.client_id"); $row = mysql_fetch_array($result,MYSQL_ASSOC); $count = $row['count']; if( $count >0 ) { $total_pages = ceil($count/$limit); } else { $total_pages = 0; } if ($page > $total_pages) $page=$total_pages; $start = $limit*$page - $limit; // do not put $limit*($page - 1) if ($start < 0) $start = 0; $SQL = "SELECT a.id, a.invdate, b.name, a.amount,a.tax,a.total,a.note FROM invheader a, clients b WHERE a.client_id=b.client_id ORDER BY $sidx $sord LIMIT $start , $limit"; $result = mysql_query( $SQL ) or die("Couldn’t execute query.".mysql_error()); if ( stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml") ) { header("Content-type: application/xhtml+xml;charset=utf-8"); } else { header("Content-type: text/xml;charset=utf-8"); } $et = ">"; echo "<?xml version='1.0' encoding='utf-8'?$et\n"; echo "<rows>"; echo "<page>".$page."</page>"; echo "<total>".$total_pages."</total>"; echo "<records>".$count."</records>"; // be sure to put text data in CDATA while($row = mysql_fetch_array($result,MYSQL_ASSOC)) { echo "<row id='". $row[id]."'>"; echo "<cell>". $row[id]."</cell>"; echo "<cell>". $row[invdate]."</cell>"; echo "<cell><![CDATA[". $row[name]."]]></cell>"; echo "<cell>". $row[amount]."</cell>"; echo "<cell>". $row[tax]."</cell>"; echo "<cell>". $row[total]."</cell>"; echo "<cell><![CDATA[". $row[note]."]]></cell>"; echo "</row>"; } echo "</rows>"; </XMP> <b>PHP with MySQL Subgrid</b> <XMP> $examp = $_GET["q"]; //query number $id = $_GET['id']; // connect to the database $db = mysql_connect($dbhost, $dbuser, $dbpassword) or die("Connection Error: " . mysql_error()); mysql_select_db($database) or die("Error conecting to db."); $SQL = "SELECT num, item, qty, unit FROM invlines WHERE id=".$id." ORDER BY item"; $result = mysql_query( $SQL ) or die("Couldn’t execute query.".mysql_error()); if ( stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml") ) { header("Content-type: application/xhtml+xml;charset=utf-8"); } else { header("Content-type: text/xml;charset=utf-8"); } $et = ">"; echo "<?xml version='1.0' encoding='utf-8'?$et\n"; echo "<rows>"; // be sure to put text data in CDATA while($row = mysql_fetch_array($result,MYSQL_ASSOC)) { echo "<row>"; echo "<cell>". $row[num]."</cell>"; echo "<cell><![CDATA[". $row[item]."]]></cell>"; echo "<cell>". $row[qty]."</cell>"; echo "<cell>". $row[unit]."</cell>"; echo "<cell>". number_format($row[qty]*$row[unit],2,'.',' ')."</cell>"; echo "</row>"; } echo "</rows>"; </XMP> </div>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/subgrid.html
HTML
art
4,736
jQuery("#58remote2").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, sorttype:'int',summaryType:'count', summaryTpl : '({0}) total'}, {name:'invdate',index:'invdate', width:90, sorttype:'date', formatter:'date', datefmt:'d/m/Y'}, {name:'name',index:'name', width:100}, {name:'amount',index:'amount', width:80, align:"right", sorttype:'number',formatter:'number',summaryType:'sum'}, {name:'tax',index:'tax', width:80, align:"right",sorttype:'number',formatter:'number',summaryType:'sum'}, {name:'total',index:'total', width:80,align:"right",sorttype:'number',formatter:'number', summaryType:'sum'}, {name:'note',index:'note', width:150, sortable:false,editable:true} ], rowNum:30, rowList:[10,20,30], height: 'auto', pager: '#p58remote2', sortname: 'invdate', viewrecords: true, sortorder: "desc", caption:"Grouping with remote data", grouping: true, groupingView : { groupField : ['name'], groupColumnShow : [true], groupText : ['<b>{0}</b>'], groupCollapse : false, groupOrder: ['asc'], groupSummary : [true], showSummaryOnHide: true, groupDataSorted : true }, footerrow: true, userDataOnFooter: true }); jQuery("#58remote2").jqGrid('navGrid','#p58remote2',{add:false,edit:false,del:false});
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/38remote5.js
JavaScript
art
1,495
<?php include("dbconfig.php"); $examp = $_REQUEST["q"]; //query number $page = $_REQUEST['page']; // get the requested page $limit = $_REQUEST['rows']; // get how many rows we want to have into the grid $sidx = $_REQUEST['sidx']; // get index row - i.e. user click to sort $sord = $_REQUEST['sord']; // get the direction if(!$sidx) $sidx =1; // search options // IMPORTANT NOTE!!!!!!!!!!!!!!!!!!!!!!!!!!!! // this type of constructing is not recommendet // it is only for demonstration //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $wh = ""; $searchOn = Strip($_REQUEST['_search']); if($searchOn=='true') { $fld = Strip($_REQUEST['searchField']); if( $fld=='id' || $fld =='invdate' || $fld=='name' || $fld=='amount' || $fld=='tax' || $fld=='total' || $fld=='note' || $fld=='closed' || $fld=='ship_via') { $fldata = Strip($_REQUEST['searchString']); $foper = Strip($_REQUEST['searchOper']); // costruct where $wh .= " AND ".$fld; switch ($foper) { case "bw": $fldata .= "%"; $wh .= " LIKE '".$fldata."'"; break; case "eq": if(is_numeric($fldata)) { $wh .= " = ".$fldata; } else { $wh .= " = '".$fldata."'"; } break; case "ne": if(is_numeric($fldata)) { $wh .= " <> ".$fldata; } else { $wh .= " <> '".$fldata."'"; } break; case "lt": if(is_numeric($fldata)) { $wh .= " < ".$fldata; } else { $wh .= " < '".$fldata."'"; } break; case "le": if(is_numeric($fldata)) { $wh .= " <= ".$fldata; } else { $wh .= " <= '".$fldata."'"; } break; case "gt": if(is_numeric($fldata)) { $wh .= " > ".$fldata; } else { $wh .= " > '".$fldata."'"; } break; case "ge": if(is_numeric($fldata)) { $wh .= " >= ".$fldata; } else { $wh .= " >= '".$fldata."'"; } break; case "ew": $wh .= " LIKE '%".$fldata."'"; break; case "ew": $wh .= " LIKE '%".$fldata."%'"; break; default : $wh = ""; } } } // connect to the database $db = mysql_connect($dbhost, $dbuser, $dbpassword) or die("Connection Error: " . mysql_error()); mysql_select_db($database) or die("Error conecting to db."); switch ($examp) { case 1: $result = mysql_query("SELECT COUNT(*) AS count FROM invheader a, clients b WHERE a.client_id=b.client_id ".$wh); $row = mysql_fetch_array($result,MYSQL_ASSOC); $count = $row['count']; if( $count >0 ) { $total_pages = ceil($count/$limit); } else { $total_pages = 0; } if ($page > $total_pages) $page=$total_pages; $start = $limit*$page - $limit; // do not put $limit*($page - 1) if ($start<0) $start = 0; $SQL = "SELECT a.id, a.invdate, b.name, a.amount,a.tax,a.total,a.note,a.closed,a.ship_via FROM invheader a, clients b WHERE a.client_id=b.client_id".$wh." ORDER BY ".$sidx." ". $sord." LIMIT ".$start." , ".$limit; $result = mysql_query( $SQL ) or die("Couldn t execute query.".mysql_error()); if ( stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml") ) { header("Content-type: application/xhtml+xml;charset=utf-8"); } else { header("Content-type: text/xml;charset=utf-8"); } $et = ">"; $s = "<?xml version='1.0' encoding='utf-8'?$et\n"; $s .= "<rows>"; $s .= "<page>".$page."</page>"; $s .= "<total>".$total_pages."</total>"; $s .= "<records>".$count."</records>"; // be sure to put text data in CDATA while($row = mysql_fetch_array($result,MYSQL_ASSOC)) { $s .= "<row id='". $row[id]."'>"; $s .= "<cell>". $row[id]."</cell>"; $s .= "<cell>". $row[invdate]."</cell>"; $s .= "<cell><![CDATA[". $row[name]."]]></cell>"; $s .= "<cell>". $row[amount]."</cell>"; $s .= "<cell>". $row[tax]."</cell>"; $s .= "<cell>". $row[total]."</cell>"; $s .= "<cell>". $row[closed]."</cell>"; if( $row[ship_via] == 'TN') $s .= "<cell>TNT</cell>"; else if( $row[ship_via] == 'FE') $s .= "<cell>FedEx</cell>"; else $s .= "<cell></cell>"; $s .= "<cell><![CDATA[". $row[note]."]]></cell>"; $s .= "</row>"; } $s .= "</rows>"; echo $s; break; } mysql_close($db); function Strip($value) { if(get_magic_quotes_gpc() != 0) { if(is_array($value)) if ( array_is_associative($value) ) { foreach( $value as $k=>$v) $tmp_val[$k] = stripslashes($v); $value = $tmp_val; } else for($j = 0; $j < sizeof($value); $j++) $value[$j] = stripslashes($value[$j]); else $value = stripslashes($value); } return $value; } function array_is_associative ($array) { if ( is_array($array) && ! empty($array) ) { for ( $iterator = count($array) - 1; $iterator; $iterator-- ) { if ( ! array_key_exists($iterator, $array) ) { return true; } } return ! array_key_exists(0, $array); } return false; } ?>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/editing.php
PHP
art
5,017
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"}, {id:"6",invdate:"2007-09-06",name:"test3",note:"note3",tax:"30.00",total:"430.00"}, {id:"7",invdate:"2007-10-04",name:"test",note:"note",tax:"10.00",total:"210.00"}, {id:"8",invdate:"2007-10-03",name:"test2",note:"note2",amount:"300.00",tax:"21.00",total:"320.00"}, {id:"9",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}, {id:"11",invdate:"2007-10-01",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"}, {id:"12",invdate:"2007-10-02",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"}, {id:"13",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}, {id:"14",invdate:"2007-10-04",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"}, {id:"15",invdate:"2007-10-05",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"}, {id:"16",invdate:"2007-09-06",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}, {id:"17",invdate:"2007-10-04",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"}, {id:"18",invdate:"2007-10-03",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"}, {id:"19",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}, {id:"21",invdate:"2007-10-01",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"}, {id:"22",invdate:"2007-10-02",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"}, {id:"23",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}, {id:"24",invdate:"2007-10-04",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"}, {id:"25",invdate:"2007-10-05",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"}, {id:"26",invdate:"2007-09-06",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}, {id:"27",invdate:"2007-10-04",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"}, {id:"28",invdate:"2007-10-03",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"} ]; jQuery("#list484").jqGrid({ data: mydata, datatype: "local", height: 'auto', rowNum: 30, rowList: [10,20,30], colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','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, editable:true}, {name:'amount',index:'amount', width:80, align:"right",sorttype:"float", formatter:"number", editable:true}, {name:'tax',index:'tax', width:80, align:"right",sorttype:"float", editable:true}, {name:'total',index:'total', width:80,align:"right",sorttype:"float"}, {name:'note',index:'note', width:150, sortable:false} ], pager: "#plist484", viewrecords: true, sortname: 'name', direction : "rtl", grouping:true, groupingView : { groupField : ['name'], groupColumnShow : [false], groupText : ['<b> Items {1} {0} </b>'] }, caption: "RTL Support" });
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/38array4.js
JavaScript
art
3,643
<div style="font-size:12px;"> This module is contributed from Peter Romianowski <br> The module convert existing html table to Grid<br> </div> <br /> <br/> <a href="#" id="ttogrid">Convert To Grid</a> <br/><br> <div style="width:500px;"> <table id="mytable" border="1"> <thead> <tr> <th>Header1</th> <th>Header2</th> <th>Header3</th> </tr> </thead> <tbody> <tr> <td>Cell 11</td> <td>Cell 12</td> <td>Cell 13</td> </tr> <tr> <td>Cell 21</td> <td>Cell 22</td> <td>Cell 23</td> </tr> <tr> <td>Cell 31</td> <td>Cell 32</td> <td>Cell 33</td> </tr> </tbody> </table> </div> <script src="tbltogrid.js" type="text/javascript"> </script> <br /> <div style="font-size:12px;"> <b> HTML </b> <XMP> <a href="#" id="ttogrid">Convert To Grid</a> <br/><br> <div style="width:500px;"> <table id="mytable" border="1"> <thead> <tr> <th>Header1</th> <th>Header2</th> <th>Header3</th> </tr> </thead> <tbody> <tr> <td>Cell 11</td> <td>Cell 12</td> <td>Cell 13</td> </tr> <tr> <td>Cell 21</td> <td>Cell 22</td> <td>Cell 23</td> </tr> <tr> <td>Cell 31</td> <td>Cell 32</td> <td>Cell 33</td> </tr> </tbody> </table> </div> <script src="tbltogrid.js" type="text/javascript"> </script> </XMP> <b>Java Scrpt code</b> <XMP> jQuery("#ttogrid").click(function (){ tableToGrid("#mytable"); }); </XMP> </div>
zzh-simple-hr
ZJs/webapp/grid/jqgrid/demo40/tbltogrid.html
HTML
art
1,371