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 |
|---|---|---|---|---|---|
var myarr =
[
{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}
];
jQuery("#list18").jqGrid({
url:'server.php?q=2',
datatype: "json",
colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'],
colModel:myarr,
rowNum:10,
rowList:[10,20,30],
pager: '#pager18',
sortname: 'id',
viewrecords: true,
sortorder: "desc",
beforeInit: function() {if(1==1) myarr[4].hidden = true; }
});
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/demo40/hidedyn.js | JavaScript | art | 765 |
<!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 Demo</title>
<style>
html, body {
margin: 0; /* Remove body margin/padding */
padding: 0;
overflow: auto; /* Remove scroll bars on browser window */
font: 12px "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana;
}
</style>
<!-- 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> | zzh-simple-hr | ZJs/webapp/grid/jqgrid/demo40/example.html | HTML | art | 3,643 |
<div style="font-size:12px;">
This example show how we can load XML Grid Configuration from external xml file <br>
A JSON import is also available. Press a Convert link to perform the conversion<br>
</div>
<br />
<table id="xmlist1"></table>
<div id="xmlpager1"></div>
<script src="xmlimp.js" type="text/javascript"> </script>
<br />
<a id="cnvxml" href="#">convert</a>
<br>
<br/>
<a href="testxml.xml">The XML example file look like this</a>
<br>
<br>
<div style="font-size:12px;">
<b> HTML </b>
<XMP>
...
<table id="xmlist1"></table>
<div id="xmlpager1"></div>
</XMP>
<b>Java Scrpt code</b>
<XMP>
$("#cnvxml").click(function(){
$("#xmlist1").jqGrid('jqGridImport',{impurl:"testxml.xml"});
$(this).hide();
});
...
</XMP>
</div> | zzh-simple-hr | ZJs/webapp/grid/jqgrid/demo40/xmlimp.html | HTML | art | 773 |
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"
});
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/demo40/loadoncex.js | JavaScript | art | 831 |
<div style="font-size:12px;">
This example demonstartes a setCell and setLabel methods. We can change the contents <br/>
and style of the particular header and cell. Again with this we use a loadui option <br/>
to disable interaction when the data is loaded
</div>
<br/>
<br/>
<table id="method32"></table>
<div id="pmethod32"></div>
<br />
<a href="javascript:void(0)" id="shc">Change the content of header Tax</a>
<br />
<a href="javascript:void(0)" id="scc">Cahnge the tax of row 12</a>
<br />
<a href="javascript:void(0)" id="cdat">Clear the currently loaded data</a>
<br />
<script src="methods32.js" type="text/javascript"> </script>
<br />
<br />
<div style="font-size:12px;">
<b> HTML </b>
<XMP>
...
<br/>
<br/>
<table id="method32"></table>
<div id="pmethod32"></div>
<br />
<a href="javascript:void(0)" id="shc">Change the content of header Tax</a>
<br />
<a href="javascript:void(0)" id="scc">Cahnge the tax of row 12</a>
<br />
<a href="javascript:void(0)" id="cdat">Clear the currently loaded data</a>
<br />
<script src="methods32.js" type="text/javascript"> </script>
</XMP>
<b>Java Scrpt code</b>
<XMP>
...
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');
});
</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("Couldnt 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/methods32.html | HTML | art | 4,451 |
<p style="font-size:12px;">
This sample demonstrates the new rendering engine of jqGrid.<br>
In the versions before 3.5 beta jqGrid renders a big data sets slow. This is changed in 3.5 beta.<br>
By default jqGrid renders a data 3-5 time faster compared with previous releses, but there is a more.<br>
When we use the option griedview set to true it is possibe to speed the reading process from 5-10 times.<br>
This is achieved by reading the data at once. This mode has some limitations - it is not possible to use <br>
treeGrid, subGrid and afterInsertRow (event). Enjoy the speed!
<br />
<div id="speed_div"></div>
<br/>
<table id="speed"></table>
<div id="speedp"></div>
<script src="speed.js" type="text/javascript"> </script>
<br />
<div style="font-size:12px;">
<b> HTML </b>
<XMP>
...
<table id="speed"></table>
<div id="speedp"></div>
<script src="speed.js" type="text/javascript"> </script>
</XMP>
<b>Java Scrpt code</b>
<XMP>
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 ");
}
});
</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("Couldnt 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/speed.html | HTML | art | 3,750 |
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
);
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/demo40/csvalid.js | JavaScript | art | 1,700 |
jQuery("#selall").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: '#pselall',
sortname: 'id',
viewrecords: true,
sortorder: "desc",
multiselect: true,
caption:"onSelectAll Event",
onSelectAll : function(aSel,selected) {
if(selected){
var value =0;
for(var i=0;i<aSel.length;i++){
var data = jQuery("#selall").jqGrid('getRowData',aSel[i]);
value += parseFloat(data.total);
}
jQuery("#totamt").html(value.toFixed(2));
} else {
jQuery("#totamt").html('0.00');
}
},
onSelectRow : function(rowid, selected){
var data = jQuery("#selall").jqGrid('getRowData',rowid);
var value = parseFloat(jQuery.trim(jQuery("#totamt").html()));
if(selected) {
value += parseFloat(data.total);
} else {
value -= parseFloat(data.total);
}
jQuery("#totamt").html(value.toFixed(2));
},
onPaging: function(b){
jQuery("#totamt").html('0.00');
},
onSortCol: function (a,b){
jQuery("#totamt").html('0.00');
}
});
jQuery("#selall").jqGrid('navGrid','#pmethod',{edit:false,add:false,del:false});
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/demo40/selectall.js | JavaScript | art | 1,624 |
<div style="font-size:12px;">
The groupig also works with remoute data. If the option groupDataSorted is turned on then to the sidx parameter is<br/>
added the grouping column name. This way the server know that it should first sort by the grouping column and then <br/>
to the sort column.<br/>
</div>
<br />
<table id="48remote"></table>
<div id="p48remote"></div>
<script src="38remote1.js" type="text/javascript"></script>
<br />
<div style="font-size:12px;">
<b> HTML </b>
<XMP>
...
<table id="list4"><tr><td> </td></tr></table>
</XMP>
<b>Java Scrpt code</b>
<XMP>
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});
</XMP>
</div> | zzh-simple-hr | ZJs/webapp/grid/jqgrid/demo40/38remote1.html | HTML | art | 2,007 |
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('hideCol',"tax");
});
jQuery("#sc").click( function() {
jQuery("#list17").jqGrid('showCol',"tax");
});
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/demo40/hideex.js | JavaScript | art | 1,007 |
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"});
}
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/demo40/calen.js | JavaScript | art | 2,146 |
<div style="font-size:12px;">
This example demonstrates multi selection of rows
</div>
<br />
<table id="list9"></table>
<div id="pager9"></div>
<br />
<a href="javascript:void(0)" id="m1">Get Selected id's</a><br/>
<a href="javascript:void(0)" id="m1s">Select(Unselect) row 13</a>
<script src="multiex.js" type="text/javascript"> </script>
<br />
<br />
<div style="font-size:12px;">
<b> HTML </b>
<XMP>
...
<table id="list9"></table>
<div id="pager9"></div>
<br />
<a href="javascript:void(0)" id="m1">Get Selected id's</a>
<a href="javascript:void(0)" id="m1s">Select(Unselect) row 13</a>
</XMP>
<b>Java Scrpt code</b>
<XMP>
...
jQuery("#list9").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: '#pager9',
sortname: 'id',
recordpos: 'left',
viewrecords: true,
sortorder: "desc",
multiselect: true,
caption: "Multi Select Example"
});
jQuery("#list9").jqGrid('navGrid','#pager9',{add:false,del:false,edit:false,position:'right'});
jQuery("#m1").click( function() {
var s;
s = jQuery("#list9").jqGrid('getGridParam','selarrrow');
alert(s);
});
jQuery("#m1s").click( function() {
jQuery("#list9").jqGrid('setSelection',"13");
});
</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/multiex.html | HTML | art | 3,292 |
/* Multiselect
----------------------------------*/
.ui-multiselect { border: solid 1px; font-size: 0.8em; }
.ui-multiselect ul { -moz-user-select: none; }
.ui-multiselect li { margin: 0; padding: 0; cursor: default; line-height: 20px; height: 20px; font-size: 11px; list-style: none; }
.ui-multiselect li a { color: #999; text-decoration: none; padding: 0; display: block; float: left; cursor: pointer;}
.ui-multiselect li.ui-draggable-dragging { padding-left: 10px; }
.ui-multiselect div.selected { position: relative; padding: 0; margin: 0; border: 0; float:left; }
.ui-multiselect ul.selected { position: relative; padding: 0; overflow: auto; overflow-x: hidden; background: #fff; margin: 0; list-style: none; border: 0; position: relative; width: 100%; }
.ui-multiselect ul.selected li { }
.ui-multiselect div.available { position: relative; padding: 0; margin: 0; border: 0; float:left; border-left: 1px solid; }
.ui-multiselect ul.available { position: relative; padding: 0; overflow: auto; overflow-x: hidden; background: #fff; margin: 0; list-style: none; border: 0; width: 100%; }
.ui-multiselect ul.available li { padding-left: 10px; }
.ui-multiselect .ui-state-default { border: none; margin-bottom: 1px; position: relative; padding-left: 20px;}
.ui-multiselect .ui-state-hover { border: none; }
.ui-multiselect .ui-widget-header {border: none; font-size: 11px; margin-bottom: 1px;}
.ui-multiselect .add-all { float: right; padding: 7px;}
.ui-multiselect .remove-all { float: right; padding: 7px;}
.ui-multiselect .search { float: left; padding: 4px;}
.ui-multiselect .count { float: left; padding: 7px;}
.ui-multiselect li span.ui-icon-arrowthick-2-n-s { position: absolute; left: 2px; }
.ui-multiselect li a.action { position: absolute; right: 2px; top: 2px; }
.ui-multiselect input.search { height: 14px; padding: 1px; opacity: 0.5; margin: 4px; width: 100px; } | zzh-simple-hr | ZJs/webapp/grid/jqgrid/demo40/themes/ui.multiselect.css | CSS | art | 1,886 |
/*Grid*/
.ui-jqgrid {position: relative; font-size:11px;}
.ui-jqgrid .ui-jqgrid-view {position: relative;left:0px; top: 0px; padding: .0em;}
/* caption*/
.ui-jqgrid .ui-jqgrid-titlebar {padding: .3em .2em .2em .3em; position: relative; border-left: 0px none;border-right: 0px none; border-top: 0px none;}
.ui-jqgrid .ui-jqgrid-title { float: left; margin: .1em 0 .2em; }
.ui-jqgrid .ui-jqgrid-titlebar-close { position: absolute;top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height:18px;}.ui-jqgrid .ui-jqgrid-titlebar-close span { display: block; margin: 1px; }
.ui-jqgrid .ui-jqgrid-titlebar-close:hover { padding: 0; }
/* header*/
.ui-jqgrid .ui-jqgrid-hdiv {position: relative; margin: 0em;padding: 0em; overflow-x: hidden; overflow-y: auto; border-left: 0px none !important; border-top : 0px none !important; border-right : 0px none !important;}
.ui-jqgrid .ui-jqgrid-hbox {float: left; padding-right: 20px;}
.ui-jqgrid .ui-jqgrid-htable {table-layout:fixed;margin:0em;}
.ui-jqgrid .ui-jqgrid-htable th {height:22px;padding: 0 2px 0 2px;}
.ui-jqgrid .ui-jqgrid-htable th div {overflow: hidden; position:relative; height:17px;}
.ui-th-column, .ui-jqgrid .ui-jqgrid-htable th.ui-th-column {overflow: hidden;white-space: nowrap;text-align:center;border-top : 0px none;border-bottom : 0px none;}
.ui-th-ltr, .ui-jqgrid .ui-jqgrid-htable th.ui-th-ltr {border-left : 0px none;}
.ui-th-rtl, .ui-jqgrid .ui-jqgrid-htable th.ui-th-rtl {border-right : 0px none;}
.ui-jqgrid .ui-th-div-ie {white-space: nowrap; zoom :1; height:17px;}
.ui-jqgrid .ui-jqgrid-resize {height:20px !important;position: relative; cursor :e-resize;display: inline;overflow: hidden;}
.ui-jqgrid .ui-grid-ico-sort {overflow:hidden;position:absolute;display:inline; cursor: pointer !important;}
.ui-jqgrid .ui-icon-asc {margin-top:-3px; height:12px;}
.ui-jqgrid .ui-icon-desc {margin-top:3px;height:12px;}
.ui-jqgrid .ui-i-asc {margin-top:0px;height:16px;}
.ui-jqgrid .ui-i-desc {margin-top:0px;margin-left:13px;height:16px;}
.ui-jqgrid .ui-jqgrid-sortable {cursor:pointer;}
.ui-jqgrid tr.ui-search-toolbar th { border-top-width: 1px !important; border-top-color: inherit !important; border-top-style: ridge !important }
tr.ui-search-toolbar input {margin: 1px 0px 0px 0px}
tr.ui-search-toolbar select {margin: 1px 0px 0px 0px}
/* body */
.ui-jqgrid .ui-jqgrid-bdiv {position: relative; margin: 0em; padding:0; overflow: auto; text-align:left;}
.ui-jqgrid .ui-jqgrid-btable {table-layout:fixed; margin:0em; outline-style: none; }
.ui-jqgrid tr.jqgrow { outline-style: none; }
.ui-jqgrid tr.jqgroup { outline-style: none; }
.ui-jqgrid tr.jqgrow td {font-weight: normal; overflow: hidden; white-space: pre; height: 22px;padding: 0 2px 0 2px;border-bottom-width: 1px; border-bottom-color: inherit; border-bottom-style: solid;}
.ui-jqgrid tr.jqgfirstrow td {padding: 0 2px 0 2px;border-right-width: 1px; border-right-style: solid;}
.ui-jqgrid tr.jqgroup td {font-weight: normal; overflow: hidden; white-space: pre; height: 22px;padding: 0 2px 0 2px;border-bottom-width: 1px; border-bottom-color: inherit; border-bottom-style: solid;}
.ui-jqgrid tr.jqfoot td {font-weight: bold; overflow: hidden; white-space: pre; height: 22px;padding: 0 2px 0 2px;border-bottom-width: 1px; border-bottom-color: inherit; border-bottom-style: solid;}
.ui-jqgrid tr.ui-row-ltr td {text-align:left;border-right-width: 1px; border-right-color: inherit; border-right-style: solid;}
.ui-jqgrid tr.ui-row-rtl td {text-align:right;border-left-width: 1px; border-left-color: inherit; border-left-style: solid;}
.ui-jqgrid td.jqgrid-rownum { padding: 0 2px 0 2px; margin: 0px; border: 0px none;}
.ui-jqgrid .ui-jqgrid-resize-mark { width:2px; left:0; background-color:#777; cursor: e-resize; cursor: col-resize; position:absolute; top:0; height:100px; overflow:hidden; display:none; border:0 none;}
/* footer */
.ui-jqgrid .ui-jqgrid-sdiv {position: relative; margin: 0em;padding: 0em; overflow: hidden; border-left: 0px none !important; border-top : 0px none !important; border-right : 0px none !important;}
.ui-jqgrid .ui-jqgrid-ftable {table-layout:fixed; margin-bottom:0em;}
.ui-jqgrid tr.footrow td {font-weight: bold; overflow: hidden; white-space:nowrap; height: 21px;padding: 0 2px 0 2px;border-top-width: 1px; border-top-color: inherit; border-top-style: solid;}
.ui-jqgrid tr.footrow-ltr td {text-align:left;border-right-width: 1px; border-right-color: inherit; border-right-style: solid;}
.ui-jqgrid tr.footrow-rtl td {text-align:right;border-left-width: 1px; border-left-color: inherit; border-left-style: solid;}
/* Pager*/
.ui-jqgrid .ui-jqgrid-pager { border-left: 0px none !important;border-right: 0px none !important; border-bottom: 0px none !important; margin: 0px !important; padding: 0px !important; position: relative; height: 25px;white-space: nowrap;overflow: hidden;}
.ui-jqgrid .ui-pager-control {position: relative;}
.ui-jqgrid .ui-pg-table {position: relative; padding-bottom:2px; width:auto; margin: 0em;}
.ui-jqgrid .ui-pg-table td {font-weight:normal; vertical-align:middle; padding:1px;}
.ui-jqgrid .ui-pg-button { height:19px !important;}
.ui-jqgrid .ui-pg-button span { display: block; margin: 1px; float:left;}
.ui-jqgrid .ui-pg-button:hover { padding: 0px; }
.ui-jqgrid .ui-state-disabled:hover {padding:1px;}
.ui-jqgrid .ui-pg-input { height:13px;font-size:.8em; margin: 0em;}
.ui-jqgrid .ui-pg-selbox {font-size:.8em; line-height:18px; display:block; height:18px; margin: 0em;}
.ui-jqgrid .ui-separator {height: 18px; border-left: 1px solid #ccc ; border-right: 1px solid #ccc ; margin: 1px; float: right;}
.ui-jqgrid .ui-paging-info {font-weight: normal;height:19px; margin-top:3px;margin-right:4px;}
.ui-jqgrid .ui-jqgrid-pager .ui-pg-div {padding:1px 0;float:left;list-style-image:none;list-style-position:outside;list-style-type:none;position:relative;}
.ui-jqgrid .ui-jqgrid-pager .ui-pg-button { cursor:pointer; }
.ui-jqgrid .ui-jqgrid-pager .ui-pg-div span.ui-icon {float:left;margin:0 2px;}
.ui-jqgrid td input, .ui-jqgrid td select .ui-jqgrid td textarea { margin: 0em;}
.ui-jqgrid td textarea {width:auto;height:auto;}
.ui-jqgrid .ui-jqgrid-toppager {border-left: 0px none !important;border-right: 0px none !important; border-top: 0px none !important; margin: 0px !important; padding: 0px !important; position: relative; height: 25px !important;white-space: nowrap;overflow: hidden;}
/*subgrid*/
.ui-jqgrid .ui-jqgrid-btable .ui-sgcollapsed span {display: block;}
.ui-jqgrid .ui-subgrid {margin:0em;padding:0em; width:100%;}
.ui-jqgrid .ui-subgrid table {table-layout: fixed;}
.ui-jqgrid .ui-subgrid tr.ui-subtblcell td {height:18px;border-right-width: 1px; border-right-color: inherit; border-right-style: solid;border-bottom-width: 1px; border-bottom-color: inherit; border-bottom-style: solid;}
.ui-jqgrid .ui-subgrid td.subgrid-data {border-top: 0px none !important;}
.ui-jqgrid .ui-subgrid td.subgrid-cell {border-width: 0px 0px 1px 0px;}
.ui-jqgrid .ui-th-subgrid {height:20px;}
/* loading */
.ui-jqgrid .loading {position: absolute; top: 45%;left: 45%;width: auto;z-index:101;padding: 6px; margin: 5px;text-align: center;font-weight: bold;display: none;border-width: 2px !important;}
.ui-jqgrid .jqgrid-overlay {display:none;z-index:100;}
* html .jqgrid-overlay {width: expression(this.parentNode.offsetWidth+'px');height: expression(this.parentNode.offsetHeight+'px');}
* .jqgrid-overlay iframe {position:absolute;top:0;left:0;z-index:-1;width: expression(this.parentNode.offsetWidth+'px');height: expression(this.parentNode.offsetHeight+'px');}
/* end loading div */
/* toolbar */
.ui-jqgrid .ui-userdata {border-left: 0px none; border-right: 0px none; height : 21px;overflow: hidden; }
/*Modal Window */
.ui-jqdialog { display: none; width: 300px; position: absolute; padding: .2em; font-size:11px; overflow:visible;}
.ui-jqdialog .ui-jqdialog-titlebar { padding: .3em .2em; position: relative; }
.ui-jqdialog .ui-jqdialog-title { margin: .1em 0 .2em; }
.ui-jqdialog .ui-jqdialog-titlebar-close { position: absolute; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
.ui-jqdialog .ui-jqdialog-titlebar-close span { display: block; margin: 1px; }
.ui-jqdialog .ui-jqdialog-titlebar-close:hover, .ui-jqdialog .ui-jqdialog-titlebar-close:focus { padding: 0; }
.ui-jqdialog-content, .ui-jqdialog .ui-jqdialog-content { border: 0; padding: .3em .2em; background: none; height:auto;}
.ui-jqdialog .ui-jqconfirm {padding: .4em 1em; border-width:3px;position:absolute;bottom:10px;right:10px;overflow:visible;display:none;height:80px;width:220px;text-align:center;}
/* end Modal window*/
/* Form edit */
.ui-jqdialog-content .FormGrid {margin: 0px;}
.ui-jqdialog-content .EditTable { width: 100%; margin-bottom:0em;}
.ui-jqdialog-content .DelTable { width: 100%; margin-bottom:0em;}
.EditTable td input, .EditTable td select, .EditTable td textarea {margin: 0em;}
.EditTable td textarea { width:auto; height:auto;}
.ui-jqdialog-content td.EditButton {text-align: right;border-top: 0px none;border-left: 0px none;border-right: 0px none; padding-bottom:5px; padding-top:5px;}
.ui-jqdialog-content td.navButton {text-align: center; border-left: 0px none;border-top: 0px none;border-right: 0px none; padding-bottom:5px; padding-top:5px;}
.ui-jqdialog-content input.FormElement {padding:.3em}
.ui-jqdialog-content .data-line {padding-top:.1em;border: 0px none;}
.ui-jqdialog-content .CaptionTD {text-align: left; vertical-align: middle;border: 0px none; padding: 2px;white-space: nowrap;}
.ui-jqdialog-content .DataTD {padding: 2px; border: 0px none; vertical-align: top;}
.ui-jqdialog-content .form-view-data {white-space:pre}
.fm-button { display: inline-block; margin:0 4px 0 0; padding: .4em .5em; text-decoration:none !important; cursor:pointer; position: relative; text-align: center; zoom: 1; }
.fm-button-icon-left { padding-left: 1.9em; }
.fm-button-icon-right { padding-right: 1.9em; }
.fm-button-icon-left .ui-icon { right: auto; left: .2em; margin-left: 0; position: absolute; top: 50%; margin-top: -8px; }
.fm-button-icon-right .ui-icon { left: auto; right: .2em; margin-left: 0; position: absolute; top: 50%; margin-top: -8px;}
#nData, #pData { float: left; margin:3px;padding: 0; width: 15px; }
/* End Eorm edit */
/*.ui-jqgrid .edit-cell {}*/
.ui-jqgrid .selected-row, div.ui-jqgrid .selected-row td {font-style : normal;border-left: 0px none;}
/* Tree Grid */
.ui-jqgrid .tree-wrap {float: left; position: relative;height: 18px;white-space: nowrap;overflow: hidden;}
.ui-jqgrid .tree-minus {position: absolute; height: 18px; width: 18px; overflow: hidden;}
.ui-jqgrid .tree-plus {position: absolute; height: 18px; width: 18px; overflow: hidden;}
.ui-jqgrid .tree-leaf {position: absolute; height: 18px; width: 18px;overflow: hidden;}
.ui-jqgrid .treeclick {cursor: pointer;}
/* moda dialog */
.jqmOverlay { background-color: #000; }
* iframe.jqm {position:absolute;top:0;left:0;z-index:-1;width: expression(this.parentNode.offsetWidth+'px');height: expression(this.parentNode.offsetHeight+'px');}
.ui-jqgrid-dnd tr td {border-right-width: 1px; border-right-color: inherit; border-right-style: solid; height:20px}
/* RTL Support */
.ui-jqgrid .ui-jqgrid-title-rtl {float:right;margin: .1em 0 .2em; }
.ui-jqgrid .ui-jqgrid-hbox-rtl {float: right; padding-left: 20px;}
.ui-jqgrid .ui-jqgrid-resize-ltr {float: right;margin: -2px -2px -2px 0px;}
.ui-jqgrid .ui-jqgrid-resize-rtl {float: left;margin: -2px 0px -1px -3px;}
.ui-jqgrid .ui-sort-rtl {left:0px;}
.ui-jqgrid .tree-wrap-ltr {float: left;}
.ui-jqgrid .tree-wrap-rtl {float: right;}
.ui-jqgrid .ui-ellipsis {text-overflow:ellipsis; -moz-binding:url('ellipsis-xbl.xml#ellipsis');}
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/demo40/themes/ui.jqgrid.css | CSS | art | 11,674 |
jQuery("#sortrows").jqGrid({
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: '#psortrows',
sortname: 'invdate',
viewrecords: true,
sortorder: "desc",
caption:"Sortable Rows Example"
});
jQuery("#sortrows").jqGrid('navGrid','#psortrows',{edit:false,add:false,del:false}).jqGrid('sortableRows');
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/demo40/36sortrows.js | JavaScript | art | 878 |
<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;">
This example shows the tree grid feature of jqGrid with supporting of Adjacency List Model <br>
All you need is to set treeGrid option to true, and to specify which column is expandable. <br>
Of course the data from the server should be ajusted in appropriate way.<br>
</div>
<br />
<table id="treegrid2"></table>
<div id="ptreegrid2"></div>
<script src="treegrid2.js" type="text/javascript"> </script>
<br />
<div style="font-size:12px;">
<b> HTML </b>
<XMP>
...
<table id="treegrid2"></table>
<div id="ptreegrid2"></div>
<script src="treegrid.js" type="text/javascript"> </script>
</XMP>
<b>Java Scrpt code</b>
<XMP>
...
jQuery("#treegrid2").jqGrid({
treeGrid: true,
treeGridModel : 'adjacency',
ExpandColumn : 'name',
url: 'server.php?q=tree3',
datatype: "xml",
mtype: "POST",
colNames:["id","Account","Acc Num", "Debit", "Credit","Balance"],
colModel:[
{name:'id',index:'id', width:1,hidden:true,key:true},
{name:'name',index:'name', width:180},
{name:'num',index:'acc_num', width:80, align:"center"},
{name:'debit',index:'debit', width:80, align:"right"},
{name:'credit',index:'credit', width:80,align:"right"},
{name:'balance',index:'balance', width:80,align:"right"}
],
height:'auto',
pager : "#ptreegrid2",
caption: "Treegrid example"
});
</XMP>
<b> PHP code </b>
<XMP>
// get the leaf nodes first
$SQLL = "SELECT t1.account_id FROM accounts AS t1 LEFT JOIN accounts as t2 "
." ON t1.account_id = t2.parent_id WHERE t2.account_id IS NULL";
$resultl = mysql_query( $SQLL ) or die("Couldn t execute query.".mysql_error());
$leafnodes = array();
while($rw = mysql_fetch_array($resultl,MYSQL_ASSOC)) {
$leafnodes[$rw[account_id]] = $rw[account_id];
}
// get the needed parameters
$node = (integer)$_REQUEST["nodeid"];
$n_lvl = (integer)$_REQUEST["n_level"];
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>1</page>";
echo "<total>1</total>";
echo "<records>1</records>";
if($node >0) {
$wh = 'parent_id='.$node;
// we ouput the next level
$n_lvl = $n_lvl+1;
} else {
$wh = 'ISNULL(parent_id)';
//$level = 0;
}
// This is the most easy way for this model - we use autoloading tree
// no need for recursion
$SQL = "SELECT account_id, name, acc_num, debit, credit, balance, parent_id FROM accounts WHERE ".$wh;
$result = mysql_query( $SQL ) or die("Couldn t execute query.".mysql_error());
while($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
echo "<row>";
echo "<cell>". $row[account_id]."</cell>";
echo "<cell>". $row[name]."</cell>";
echo "<cell>". $row[acc_num]."</cell>";
echo "<cell>". $row[debit]."</cell>";
echo "<cell>". $row[credit]."</cell>";
echo "<cell>". $row[balance]."</cell>";
echo "<cell>". $n_lvl."</cell>";
if(!$row[parent_id]) $valp = 'NULL'; else $valp = $row[parent_id];
echo "<cell><![CDATA[".$valp."]]></cell>";
if($row[account_id] == $leafnodes[$row[account_id]]) $leaf='true'; else $leaf = 'false';
echo "<cell>".$leaf."</cell>";
echo "<cell>false</cell>";
echo "</row>";
}
echo "</rows>";
</XMP>
</div> | zzh-simple-hr | ZJs/webapp/grid/jqgrid/demo40/treegrid2.html | HTML | art | 4,104 |
<div style="font-size:12px;">
This example show how we can add additional column into the grid to define the three actions for each row.<br>
This can be done at server side and at client side. This example shows a client side solution.<br>
To do that we use the getDataIDs, setRowData and loadComplete methods.<br>
E - means edit, S - mens Save and C - cancel Editing <br>
<b>Note:</b> Due to security reasons data is not saved to this server.
</div>
<br />
<table id="rowed2"></table>
<div id="prowed2"></div>
<br />
<script src="rowedex2.js" type="text/javascript"> </script>
<br />
<br />
<div style="font-size:12px;">
<b> HTML </b>
<XMP>
...
<table id="rowed2"></table>
<div id="prowed2"></div>
<br />
<script src="rowedex2.js" type="text/javascript"> </script>
</XMP>
<b>Java Scrpt code</b>
<XMP>
...
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').editRow('"+cl+"');\" />";
se = "<input style='height:22px;width:20px;' type='button' value='S' onclick=\"jQuery('#rowed2').saveRow('"+cl+"');\" />";
ce = "<input style='height:22px;width:20px;' type='button' value='C' onclick=\"jQuery('#rowed2').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});
</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/rowedex2.html | HTML | art | 3,955 |
<div style="font-size:12px;">
It is possible to define search templates which makes searching very easy.
</div>
<br />
<table id="grps3"></table>
<div id="pgrps3"></div>
<script src="40grpsearch3.js" type="text/javascript"> </script>
<br />
<div style="font-size:12px;">
<b> HTML </b>
<XMP>
<table id="grps3"></table>
<div id="pgrps3"></div>
</XMP>
<b>Java Scrpt code</b>
<XMP>
var template1 =
{ "groupOp": "AND",
"rules": [
{ "field": "b.name", "op": "bw", "data": "Client 1" },
{ "field": "a.amount", "op": "gt", "data": "20"}
]
};
var template2 =
{ "groupOp": "AND",
"rules": [
{ "field": "b.name", "op": "eq", "data": "Client 2" },
{ "field": "a.id", "op": "le", "data": "10"}
]
} ;
jQuery("#grps3").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, searchtype:"integer"},
{name:'invdate',index:'a.invdate', width:90},
{name:'name', index:'b.name', width:100},
{name:'amount',index:'a.amount', width:80, align:"right", searchtype:"number"},
{name:'tax',index:'a.tax', width:80, align:"right", searchtype:"number"},
{name:'total',index:'a.total', width:80,align:"right", searchtype:"number"},
{name:'note',index:'a.note', width:150, sortable:false}
],
rowNum:10,
width:700,
rowList:[10,20,30],
pager: '#pgrps3',
sortname: 'invdate',
viewrecords: true,
sortorder: "desc",
caption: "Show query in search",
height: '100%'
});
jQuery("#grps3").jqGrid('navGrid','#pgrps3',
{edit:false,add:false,del:false},
{},
{},
{},
{
multipleSearch:true,
multipleGroup:true,
showQuery: true,
// set the names of the template
"tmplNames" : ["Template One", "Template Two"],
// set the template contents
"tmplFilters": [template1, template2]
}
);
</XMP>
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/demo40/40grpsearch3.html | HTML | art | 2,003 |
<div style="font-size:12px;">
This example show the custom formatter options per field. Options are set in column model <br/>
<br/>
<br/>
</div>
<br />
<table id="cfrmgrid"></table>
<div id="pcfrmgrid"></div>
<script src="custfrm.js" type="text/javascript"> </script>
<br /><br />
<div style="font-size:12px;">
<b> Description </b>
<br />
</XMP>
<b>Java Scrpt code</b>
<XMP>
jQuery("#cfrmgrid").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,formatter: 'integer'},
{name:'invdate',index:'invdate', width:80,formatter:'date', formatoptions:{srcformat:"Y-m-d",newformat:"d-M-Y"}},
{name:'name',index:'name', width:90, formatter: 'link'},
{name:'amount',index:'amount', width:60, align:"right",formatter:'currency',formatoptions:{thousandsSeparator:","}},
{name:'tax',index:'tax', width:60, align:"right",formatter:'currency'},
{name:'total',index:'total', width:60,align:"right",formatter:'currency', formatoptions:{prefix:"€"}},
{name:'closed',index:'closed',width:55,align:'center',formatter:'checkbox'},
{name:'ship_via',index:'ship_via',width:70},
{name:'note',index:'note', width:100, sortable:false}
],
rowNum:10,
rowList:[10,20,30],
pager: '#pcfrmgrid',
sortname: 'id',
viewrecords: true,
sortorder: "desc",
caption:"Formatter Example",
height:210
});
</XMP>
</div> | zzh-simple-hr | ZJs/webapp/grid/jqgrid/demo40/custfrm.html | HTML | art | 1,556 |
<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;">
Last, but not least we develop a row drag and drop method, which allow exchanging information between<br>
grids in visual maner.<br>
This feature uses the jQuery UI draggable and droppable widgets<br>
In this exmple try to drag rows between the grids following the allowed directions
<br>
<br />
<table>
<tbody>
<tr>
<td><table id="grid1"></table><div id="pgrid1"></div></td>
<td align="center"> <===></td>
<td><table id="grid2"></table><div id="pgrid2"></div></td>
</tr>
<tr>
<td align= "center"> || </td>
<td align= "center"> </td>
<td align= "center"> </td>
</tr>
<tr>
<td align= "center"> \/ </td>
<td align= "center"> </td>
<td align= "center"> </td>
</tr>
<tr>
<td align= "center">
<table id="grid3"></table>
<div id="pgrid3"></div>
</td>
<td> </td>
<td> </td>
</tr>
</tbody>
</table>
<script src="36draganddrop.js" type="text/javascript"> </script>
<br />
<div style="font-size:12px;">
<b>Java Scrpt code</b>
<XMP>
jQuery("#grid1").jqGrid({
datatype: "local",
height: 100,
colNames: ['Id1', 'Name1', 'Values1'],
colModel: [{
name: 'id1',
index: 'id',
width: 100
}, {
name: 'name1',
index: 'name',
width: 100
}, {
name: 'values1',
index: 'values',
width: 200
}],
caption: 'Grid 1',
pager: '#pgrid1'
});
jQuery("#grid2").jqGrid({
datatype: "local",
height: 100,
colNames: ['Id2', 'Name2', 'Values2'],
colModel: [{
name: 'id2',
index: 'id',
width: 100
}, {
name: 'name2',
index: 'name',
width: 100
}, {
name: 'values2',
index: 'values',
width: 200
}],
caption: 'Grid 2',
pager: '#pgrid2'
});
jQuery("#grid3").jqGrid({
datatype: "local",
height: 'auto',
colNames: ['Id3', 'Name3', 'Values3'],
colModel: [{
name: 'id3',
index: 'id',
width: 100
}, {
name: 'name3',
index: 'name',
width: 100
}, {
name: 'values3',
index: 'values',
width: 200
}],
caption: 'Grid 3',
pager: '#pgrid3'
});
var mydata1 = [
{id1:"1",name1:"test1",values1:'One'},
{id1:"2",name1:"test2",values1:'Two'},
{id1:"3",name1:"test3",values1:'Three'}
];
var mydata2 = [
{id2:"11",name2:"test11",values2:'One1'},
{id2:"21",name2:"test21",values2:'Two1'},
{id2:"31",name2:"test31",values2:'Three1'}
];
var mydata3 = [
{id3:"12",name3:"test12",values3:'One2'},
{id3:"22",name3:"test22",values3:'Two2'},
{id3:"32",name3:"test32",values3:'Three2'}
];
for (var i = 0; i <= mydata1.length; i++) {
jQuery("#grid1").jqGrid('addRowData',i + 1, mydata1[i]);
jQuery("#grid2").jqGrid('addRowData',i + 1, mydata2[i]);
jQuery("#grid3").jqGrid('addRowData',i + 1, mydata3[i]);
}
jQuery("#grid1").jqGrid('gridDnD',{connectWith:'#grid2,#grid3'});
jQuery("#grid2").jqGrid('gridDnD',{connectWith:'#grid1'});
</XMP>
</div> | zzh-simple-hr | ZJs/webapp/grid/jqgrid/demo40/36draganddrop.html | HTML | art | 4,153 |
<div style="font-size:12px;">
This example show a online editing and saving row. This is done when the user click on some row.<br>
Note the use of a second parameter of editRow method. This way when we press Enter data is saved<br>
to the server and when we press ESC key the editing is canceled.
</div>
<br />
<table id="rowed3"></table>
<div id="prowed3"></div>
<br />
<script src="rowedex3.js" type="text/javascript"> </script>
<br />
<br />
<div style="font-size:12px;">
<b> HTML </b>
<XMP>
...
<table id="rowed3"></table>
<div id="prowed3"></div>
<br />
<script src="rowedex3.js" type="text/javascript"> </script>
</XMP>
<b>Java Scrpt code</b>
<XMP>
...
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});
</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/rowedex3.html | HTML | art | 3,336 |
<div style="font-size:12px;">
From version 3.2 we can hide and show group of columns at once. <br/>
These methods can accept array as argument as single string too. Try to resize the grid to see how <br/>
these method works <br/>
</div>
<br />
<table id="hideshow"></table>
<div id="phideshow"></div>
<br />
<a href="javascript:void(0)" id="hcg">Hide column Amount and Tax</a><br/>
<a href="javascript:void(0)" id="scg">Show column Amount and Tax</a>
<script src="hideshow.js" type="text/javascript"> </script>
<br />
<br />
<div style="font-size:12px;">
<b> HTML </b>
<XMP>
...
<table id="hideshow"></table>
<div id="phideshow"></div>
<br />
<a href="javascript:void(0)" id="hcg">Hide column Amount and Tax</a><br/>
<a href="javascript:void(0)" id="scg">Show column Amount and Tax</a>
<script src="hideshow.js" type="text/javascript"> </script>
</XMP>
<b>Java Scrpt code</b>
<XMP>
...
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"
}).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"]);
});
</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/hideshow.html | HTML | art | 3,476 |
<div style="font-size:12px;">
In some cases we need a smaller data between server and client. This example tell us how we<br>
can do that. The data is JSON and is in format:<br>
{ total: xxx, page: yyy, records: zzz, rows: [ <br>
{”Row01″,”Row 01″,”Row 02″,”Row 03″,”Row 04″}, <br>
{”Row11″,”Row 12″,”Row 12″,”Row 13″,”Row 14″}, <br>
...<br>
</div>
<br />
<table id="jsonopt"></table>
<div id="pjopt"></div>
<script src="jsonopt.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="jsonopt.js" type="text/javascript"> </script>
</XMP>
<b>Java Scrpt code</b>
<XMP>
...
jQuery("#jsonopt").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:10,
rowList:[10,20,30],
pager: '#pjopt',
sortname: 'id',
viewrecords: true,
sortorder: "desc",
jsonReader: {
repeatitems : true,
cell:"",
id: "0"
},
caption: "Data Optimization",
height: 210
});
jQuery("#jsonopt").jqGrid('navGrid','#pjopt',{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)
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("Couldnt 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/jsonopt.html | HTML | art | 3,228 |
jQuery("#colch").jqGrid({
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, hidden:true}
],
rowNum:10,
width:700,
rowList:[10,20,30],
pager: '#pcolch',
sortname: 'invdate',
shrinkToFit :false,
viewrecords: true,
sortorder: "desc",
caption:"Column Chooser Example"
});
jQuery("#colch").jqGrid('navGrid','#pcolch',{add:false,edit:false,del:false,search:false,refresh:false});
jQuery("#colch").jqGrid('navButtonAdd','#pcolch',{
caption: "Columns",
title: "Reorder Columns",
onClickButton : function (){
jQuery("#colch").jqGrid('columnChooser');
}
}); | zzh-simple-hr | ZJs/webapp/grid/jqgrid/demo40/36columnchoice.js | JavaScript | art | 1,106 |
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;
} | zzh-simple-hr | ZJs/webapp/grid/jqgrid/demo40/rowedex4.js | JavaScript | art | 1,287 |
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});
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/demo40/subgrid.js | JavaScript | art | 1,028 |
<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 great feature which is requested many times from the community - custom cretion of editable elements<br>
This is done with the following settings in colModel - edittype:'custom' and two functions - one to create the element and <br>
another to get the value from it<br>
In this exmple click on row to edit it and see what is happen when you perform saving in the column Client..
<br/>
<br />
<table id="cinput"></table>
<div id="pcinput"></div>
<script src="36custinput.js" type="text/javascript"> </script>
<br />
<div style="font-size:12px;">
<b> HTML </b>
<XMP>
<table id="cinput"></table>
<div id="pcinput"></div>
</XMP>
<b>Java Scrpt code</b>
<XMP>
var lastsel;
function my_input(value, options) {
return $("<input type='text' size='10' value='"+value+"'/>");
}
function my_value(value) {
return "My value: "+value.val();
}
jQuery("#cinput").jqGrid({
url:'server.php?q=2',
datatype: "json",
colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'],
colModel:[
{name:'id',index:'id', width:55, editable:true},
{name:'invdate',index:'invdate', width:90,editable:true},
{
name:'name',
index:'name',
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"
});
</XMP>
</div> | zzh-simple-hr | ZJs/webapp/grid/jqgrid/demo40/36custinput.html | HTML | art | 2,756 |
jQuery("#grid1").jqGrid({
datatype: "local",
height: 100,
colNames: ['Id1', 'Name1', 'Values1'],
colModel: [{
name: 'id1',
index: 'id',
width: 100
}, {
name: 'name1',
index: 'name',
width: 100
}, {
name: 'values1',
index: 'values',
width: 200
}],
caption: 'Grid 1',
pager: '#pgrid1'
});
jQuery("#grid2").jqGrid({
datatype: "local",
height: 100,
colNames: ['Id2', 'Name2', 'Values2'],
colModel: [{
name: 'id2',
index: 'id',
width: 100
}, {
name: 'name2',
index: 'name',
width: 100
}, {
name: 'values2',
index: 'values',
width: 200
}],
caption: 'Grid 2',
pager: '#pgrid2'
});
jQuery("#grid3").jqGrid({
datatype: "local",
height: 'auto',
colNames: ['Id3', 'Name3', 'Values3'],
colModel: [{
name: 'id3',
index: 'id',
width: 100
}, {
name: 'name3',
index: 'name',
width: 100
}, {
name: 'values3',
index: 'values',
width: 200
}],
caption: 'Grid 3',
pager: '#pgrid3'
});
var mydata1 = [
{id1:"1",name1:"test1",values1:'One'},
{id1:"2",name1:"test2",values1:'Two'},
{id1:"3",name1:"test3",values1:'Three'}
];
var mydata2 = [
{id2:"11",name2:"test11",values2:'One1'},
{id2:"21",name2:"test21",values2:'Two1'},
{id2:"31",name2:"test31",values2:'Three1'}
];
var mydata3 = [
{id3:"12",name3:"test12",values3:'One2'},
{id3:"22",name3:"test22",values3:'Two2'},
{id3:"32",name3:"test32",values3:'Three2'}
];
for (var i = 0; i <= mydata1.length; i++) {
jQuery("#grid1").jqGrid('addRowData',i + 1, mydata1[i]);
jQuery("#grid2").jqGrid('addRowData',i + 1, mydata2[i]);
jQuery("#grid3").jqGrid('addRowData',i + 1, mydata3[i]);
}
jQuery("#grid1").jqGrid('gridDnD',{connectWith:'#grid2,#grid3'});
jQuery("#grid2").jqGrid('gridDnD',{connectWith:'#grid1'});
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/demo40/36draganddrop.js | JavaScript | art | 2,113 |
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: '#pager1',
sortname: 'id',
viewrecords: true,
sortorder: "desc",
caption:"XML Example",
editurl:"someurl.php"
});
jQuery("#list1").jqGrid('navGrid','#pager1',{edit:false,add:false,del:false});
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/demo40/xmlex.js | JavaScript | art | 848 |
<div style="font-size:12px;">
With the groupCollapse option is possible to hide all the data when it is loaded and show only grouping headers <br/>
In this example we set the grouping order to descending<br/><br/>
</div>
<br />
<table id="list485"></table>
<div id="plist485"></div>
<script src="38array5.js" type="text/javascript"></script>
<br />
<div style="font-size:12px;">
<b> HTML </b>
<XMP>
...
<table id="list485"></table>
<div id="plist485"></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("#list485").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: "#plist485",
viewrecords: true,
sortname: 'name',
grouping:true,
groupingView : {
groupField : ['name'],
groupColumnShow : [true],
groupText : ['<b>{0} - {1} Item(s)</b>'],
groupCollapse : true,
groupOrder: ['desc']
},
caption: "Initially hidden data"
});
</XMP>
</div> | zzh-simple-hr | ZJs/webapp/grid/jqgrid/demo40/38array5.html | HTML | art | 4,332 |
<div style="font-size:12px;">
This example demonstartes a form search of multi search<br>
Just click on search button.
</div>
<br />
<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>
<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>
...
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"});
</XMP>
<b>PHP with MySQL</b>
<XMP>
See prevoious example.
</XMP>
</div> | zzh-simple-hr | ZJs/webapp/grid/jqgrid/demo40/search2.html | HTML | art | 2,788 |
<div style="font-size:12px;">
This example accepting json data in the format of type:<br>
{ total: xxx, page: yyy, records: zzz, rows: [ <br>
{name1:”Row01″,name2:”Row 11″,name3:”Row 12″,name4:”Row 13″,name5:”Row 14″}, <br>
...<br>
Note the MySQL PHP code.
</div>
<br />
<table id="jsonmap"></table>
<div id="pjmap"></div>
<script src="jsonmap.js" type="text/javascript"> </script>
<br />
<div style="font-size:12px;">
<b> HTML </b>
<XMP>
...
<table id="jsonmap"></table>
<div id="pjmap"></div>
<script src="jsonmap.js" type="text/javascript"> </script>
</XMP>
<b>Java Scrpt code</b>
<XMP>
...
jQuery("#jsonmap").jqGrid({
url:'server.php?q=4',
datatype: "json",
colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'],
colModel:[
{name:'id',index:'id', width:55},
{name:'invdate',index:'invdate', width:90, jsonmap:"invdate"},
{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: '#pjmap',
sortname: 'id',
viewrecords: true,
sortorder: "desc",
jsonReader: {
repeatitems : false,
id: "0"
},
caption: "JSON Mapping",
height: '100%'
});
jQuery("#jsonmap").jqGrid('navGrid','#pjmap',{edit:false,add:false,del:false});
</XMP>
<b>PHP with MySQL</b>
<XMP>
...
$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("Couldnt 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]=$row;
$i++;
}
echo $json->encode($responce); // coment if php 5
break;
...
</XMP>
</div> | zzh-simple-hr | ZJs/webapp/grid/jqgrid/demo40/jsonmap.html | HTML | art | 2,630 |
<div style="font-size:12px;">
This example demonstartes onSelectAll event.This event have sense only is the option multiselect is set to true <br/>
Try to select/deselect all the rows
</div>
<br/>
<b>Total (selection)</b> <span id="totamt">0.00</span>
<br/>
<table id="selall"></table>
<div id="pselall"></div>
<script src="selectall.js" type="text/javascript"> </script>
<br />
<br />
<div style="font-size:12px;">
<b> HTML </b>
<XMP>
...
<br/>
<b>Total (selection)</b> <span id="totamt">0.00</span>
<br/>
<table id="selall"></table>
<div id="pselall"></div>
<script src="selectall.js" type="text/javascript"> </script>
</XMP>
<b>Java Scrpt code</b>
<XMP>
...
jQuery("#selall").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: '#pselall',
sortname: 'id',
viewrecords: true,
sortorder: "desc",
multiselect: true,
caption:"onSelectAll Event",
onSelectAll : function(aSel,selected) {
if(selected){
var value =0;
for(var i=0;i < aSel.length;i++){
var data = jQuery("#selall").jqGrid('getRowData',aSel[i]);
value += parseFloat(data.total);
}
jQuery("#totamt").html(value.toFixed(2));
} else {
jQuery("#totamt").html('0.00');
}
},
onSelectRow : function(rowid, selected){
var data = jQuery("#selall").jqGrid('getRowData',rowid);
var value = parseFloat(jQuery.trim(jQuery("#totamt").html()));
if(selected) {
value += parseFloat(data.total);
} else {
value -= parseFloat(data.total);
}
jQuery("#totamt").html(value.toFixed(2));
},
onPaging: function(b){
jQuery("#totamt").html('0.00');
},
onSortCol: function (a,b){
jQuery("#totamt").html('0.00');
}
});
jQuery("#selall").jqGrid('navGrid','#pmethod',{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("Couldnt 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/selectall.html | HTML | art | 4,348 |
<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;">
With this example we show another usefull feature of jqGrid - local seraching <br>
You need just enable it. <br><br>
</div>
<br />
<table id="single"></table>
<div id="psingle" ></div>
<script src="37single.js" type="text/javascript"> </script>
<br />
<div style="font-size:12px;">
<b> HTML </b>
<XMP>
...
<table id="single"></table>
<div id="psingle" ></div>
</XMP>
<b>Java Scrpt code</b>
<XMP>
...
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});
</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/37single.html | HTML | art | 3,479 |
<div style="font-size:12px;">
This example demonstrate the new feature - summary row. Also a ggod thing is that the data from userData array<br/>
can be direct putetd in the summary row just with one option userDataOnFooter - >true. <br/>
Also some new methods available for manipulating this data. getCol - return the entry coll as array.<br>
FooterData - method get or set a data on footer row.
</div>
<br />
<table id="lists2"></table>
<div id="pagers2"></div>
<script src="summary.js" type="text/javascript"> </script>
<br />
<div style="font-size:12px;">
<b> HTML </b>
<XMP>
...
<table id="list2"></table>
<div id="pager2"></div>
</XMP>
<b>Java Scrpt code</b>
<XMP>
...
jQuery("#lists2").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", formatter: 'number'},
{name:'tax',index:'tax', width:80, align:"right", formatter: 'number'},
{name:'total',index:'total', width:80,align:"right", formatter: 'number'},
{name:'note',index:'note', width:150, sortable:false}
],
rowNum:10,
rowList:[10,20,30],
pager: '#pagers2',
sortname: 'id',
viewrecords: true,
sortorder: "desc",
caption:"JSON Example",
footerrow : true,
userDataOnFooter : true,
altRows : true
});
jQuery("#lists2").jqGrid('navGrid','#pagers2',{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());
$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/summary.html | HTML | art | 3,430 |
<div style="font-size:12px;">
This example show how we can add dialog for adding data.<br/>
See below for all available options. <br/>
Note: The data is not saved to the server<br/>
</div>
<br />
<table id="addgrid"></table>
<div id="pagerad"></div>
<input type="BUTTON" id="badata" value="Add" />
<script src="adding.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").editGridRow( the_row_id, options );
</code>
<br/>
<b>the_row_id</b> when in add mode the special value must be set - "new" <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>addCaption: "Add Record"</b>,the caption of the dialog if the mode is adding<br/>
<b>editCaption: "Edit Record"</b>,the caption of the dialog if the mode is editing<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>processData: "Processing..."</b>, Indicator when posting data<br/>
<b>closeAfterAdd : false</b>, when add mode closes the dialog after add record - default false<br/>
<b>clearAfterAdd : true</b>, when add mode clears the data after adding data - default true<br/>
<b>closeAfterEdit : false</b>, when in edit mode closes the dialog after editing - default false<br/>
<b>reloadAfterSubmit : true</b> reloads grid data after posting default is true <br/>
// <i>Events</i> <br/>
<b>intializeForm: null</b> fires only once when creating the data for editing and adding.<br/>
Paramter passed to the event is the id of the constructed form.<br/>
<b>beforeInitData: null</b> fires before initialize the form data.<br/>
Paramter passed to the event is the id of the constructed form.<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 array of type name:value. 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 name:value<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("#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:"Search Example",
editurl:"someurl.php"
});
$("#bedata").click(function(){
jQuery("#editgrid").jqGrid('editGridRow',"new",{height:280,reloadAfterSubmit:false});
});
</XMP>
</div> | zzh-simple-hr | ZJs/webapp/grid/jqgrid/demo40/adding.html | HTML | art | 5,040 |
jQuery("#grps1").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, searchtype:"integer"},
{name:'invdate',index:'a.invdate', width:90},
{name:'name', index:'b.name', width:100},
{name:'amount',index:'a.amount', width:80, align:"right", searchtype:"number"},
{name:'tax',index:'a.tax', width:80, align:"right", searchtype:"number"},
{name:'total',index:'a.total', width:80,align:"right", searchtype:"number"},
{name:'note',index:'a.note', width:150, sortable:false}
],
rowNum:10,
width:700,
rowList:[10,20,30],
pager: '#pgrps1',
sortname: 'invdate',
viewrecords: true,
sortorder: "desc",
caption: "Show query in search",
height: '100%'
});
jQuery("#grps1").jqGrid('navGrid','#pgrps1',
{edit:false,add:false,del:false},
{},
{},
{},
{multipleSearch:true, multipleGroup:true, showQuery: true}
);
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/demo40/40grpsearch1.js | JavaScript | art | 1,037 |
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]);
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/demo40/localex.js | JavaScript | art | 1,728 |
<div style="font-size:12px;">
This module is contributed from Piotr Roznicki<br>
The module allow to show and hide columns via user interface<br>
Click on Hide/Show Columns link.
</div>
<br/>
<a href="#" id="vcol">Hide/Show Columns</a>
<br/><br>
<table id="setcols"></table>
<div id="psetcols"></div>
<script src="setcolumns.js" type="text/javascript"> </script>
<br />
<div style="font-size:12px;">
<b> HTML </b>
<XMP>
...
<a href="#" id="vcol">Hide/Show Columns</a>
<br/><br>
<table id="setcols"></table>
<div id="psetcols"></div>
<script src="setcolumns.js" type="text/javascript"> </script>
</XMP>
<b>Java Scrpt code</b>
<XMP>
...
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');
});
</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/setcolumns.html | HTML | art | 3,177 |
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');
});
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/demo40/methods.js | JavaScript | art | 1,330 |
<div style="font-size:12px;">
This example demonstartes the entairley rewriten searchGrid method. <br>
From now on jqGrid use a new search engine thanks to wonderful plugin provided from Kasey Speakman <br>
Note that the old behaviour of the search is saved. <br>
I will just say Enjoy! <br>
</div>
<br />
<table id="s4list"></table>
<div id="s4pager"></div>
<script src="search4.js" type="text/javascript"> </script>
<br />
<div style="font-size:12px;">
<b> HTML </b>
<XMP>
<table id="s4list"></table>
<div id="s4pager"></div>
<script src="search4.js" type="text/javascript"> </script>
</XMP>
<b>Java Scrpt code</b>
<XMP>
...
jQuery("#s4list").jqGrid({
url:'search_adv.php?q=1',
datatype: "json",
width: 700,
colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'],
colModel:[
{name:'id',index:'id', width:65, searchoptions:{sopt:['eq','ne','lt','le','gt','ge']}},
{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",searchoptions:{sopt:['eq','ne','lt','le','gt','ge']}},
{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",searchoptions:{sopt:['eq','ne','lt','le','gt','ge']}},
{name:'note',index:'note', width:150, sortable:false}
],
rowNum:10,
mtype: "POST",
rowList:[10,20,30],
pager: '#s4pager',
sortname: 'id',
viewrecords: true,
rownumbers: true,
gridview : true,
sortorder: "desc",
caption:"Advanced Search Example"
});
jQuery("#s4list").jqGrid('navGrid','#s3pager',
{
edit:false,add:false,del:false,search:true,refresh:true
},
{}, // edit options
{}, // add options
{}, //del options
{multipleSearch:true} // search options
);
</XMP>
<b>PHP with MySQL</b>
<XMP>
See search_adv.php file from demo package
</XMP>
</div> | zzh-simple-hr | ZJs/webapp/grid/jqgrid/demo40/search4.html | HTML | art | 2,127 |
<?php
$dbhost = 'localhost';
$dbuser = 'root';
$dbpassword = '';
$database = 'griddemo';
?>
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/demo40/dbconfig.php | PHP | art | 95 |
<div style="font-size:12px;">
This example demostrates the set methods in grid. The set methods in most cases<br>
are combined with .trigger('relodGrid')
</div>
<br />
<table id="list7"></table>
<div id="pager7"></div>
<br />
<a href="javascript:void(0)" id="s1">Set new url</a>
<br />
<a href="javascript:void(0)" id="s2">Set Sort to amount column</a>
<br />
<a href="javascript:void(0)" id="s3" >Set Sort new Order</a>
<br />
<a href="javascript:void(0)" id="s4">Set to view second Page</a>
<br />
<a href="javascript:void(0)" id="s5">Set new Number of Rows(15)</a>
<br />
<a href="javascript:void(0)" id="s6" >Set Data Type from json to xml</a>
<br />
<a href="javascript:void(0)" id="s7" >Set new Caption</a>
<br />
<a href="javascript:void(0)" id="s8" >Sort by Client</a>
<script src="setex.js" type="text/javascript"> </script>
<br />
<br />
<div style="font-size:12px;">
<b> HTML </b>
<XMP>
...
<table id="list7"></table>
<div id="pager7"></div>
<br />
<a href="javascript:void(0)" id="s1">Set new url</a>
<br />
<a href="javascript:void(0)" id="s2">Set Sort to amount column</a>
<br />
<a href="javascript:void(0)" id="s3" >Set Sort new Order</a>
<br />
<a href="javascript:void(0)" id="s4">Set to view second Page</a>
<br />
<a href="javascript:void(0)" id="s5">Set new Number of Rows(15)</a>
<br />
<a href="javascript:void(0)" id="s6" >Set Data Type from json to xml</a>
</XMP>
<b>Java Scrpt code</b>
<XMP>
...
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);
});
</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/setex.html | HTML | art | 4,935 |
<div style="font-size:12px;">
This example demonstartes constructing of two grids and how we <br>
can realize master detail.Try to click row on Invoice Header.
</div>
<br />
<table id="list10"></table>
<div id="pager10"></div>
<br />
<table id="list10_d"></table>
<div id="pager10_d"></div>
<a href="javascript:void(0)" id="ms1">Get Selected id's</a>
<script src="masterex.js" type="text/javascript"> </script>
<br />
<br />
<div style="font-size:12px;">
<b> HTML </b>
<XMP>
...
Invoice Header
<table id="list10"></table>
<div id="pager10"></div>
<br />
Invoice Detail
<table id="list10_d"></table>
<div id="pager10_d"></div>
<a href="javascript:void(0)" id="ms1">Get Selected id's</a>
</XMP>
<b>Java Scrpt code</b>
<XMP>
...
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"
}).navGrid('#pager10_d',{add:false,edit:false,del:false});
jQuery("#ms1").click( function() {
var s;
s = jQuery("#list10_d").jqGrid('getGridParam','selarrrow');
alert(s);
});
</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)
$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>
<b>PHP with MySQL Detail</b>
<XMP>
...
<?php
include("dbconfig.php");
$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
$id = $_GET['id'];
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.");
switch ($examp) {
case 1:
$result = mysql_query("SELECT COUNT(*) AS count FROM invlines WHERE id=".$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 num, item, qty, unit FROM invlines WHERE id=".$id." ORDER BY $sidx $sord LIMIT $start , $limit";
$result = mysql_query( $SQL ) or die("Couldnt 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[num];
$responce->rows[$i]['cell']=array($row[num],$row[item],$row[qty],$row[unit],number_format($row[qty]*$row[unit],2,'.',' '));
$i++;
}
echo json_encode($responce);
break;
}
?>
</XMP>
</div> | zzh-simple-hr | ZJs/webapp/grid/jqgrid/demo40/masterex.html | HTML | art | 6,220 |
<?php
include("../ap/phps/adodb/adodb.inc.php");
include("dbconfig.php");
$examp = $_GET["q"]; //example number
$page = $_GET["page"];
$recs = $_GET["rows"];
$sidx = $_GET["sidx"];
$sord = $_GET["sord"];
if(!$sidx) $sidx =1;
$db = ADONewConnection($dbdriver);
$db->Connect($dbhost, $dbuser,$dbpassword,$database);
switch ($examp) {
case 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;
$stmt = $db->Prepare($SQL);
$rs = $db->PageExecute($stmt, $recs ,$page);
if ($rs) {
rs2xml( $rs, $page, true);
}
break;
case 2:
break;
}
function rs2xml( &$rs, $page, $id=false)
{
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";
if( $page > $rs->LastPageNo())$page=$rs->LastPageNo();
echo "<rows>";
echo "<page>".$page."</page>";
echo "<total>".$rs->LastPageNo()."</total>";
echo "<records>".$rs->MaxRecordCount()."</records>";
$rs->MoveFirst();
$fldcnt = $rs->FieldCount();
if( $id ) $start = 0; else $start=1;
while (!$rs->EOF) {
echo "<row id='",$rs->fields[0],"'>";
for ($i=$start; $i<$fldcnt; $i++)
{
$v = $rs->fields[$i];
$fld = $rs->FetchField($i);
$type = $rs->MetaType($fld->type);
switch($type) {
case 'N':
echo "<cell>",number_format($v,2,'.',' '),'</cell>';
break;
case 'I':
echo "<cell>",$v,'</cell>';
break;
case 'D':
echo "<cell>",$rs->UserDate($v,'Y-m-d'),"</cell>";
break;
case 'T':
echo "<cell>",$rs->UserTimeStamp($v,$fmtd.' '.$fmtt),"</cell>";
break;
default :
echo "<cell><![CDATA[",$v,"]]></cell>";
}
}
$rs->MoveNext();
echo '</row>';
}
echo '</rows>';
}
?> | zzh-simple-hr | ZJs/webapp/grid/jqgrid/demo40/server_ado.php | PHP | art | 2,161 |
<div style="font-size:12px;">
This example demonstartes the new multi serach feature of jqGrid.<br>
The search fields are in the toolbar. Click on search button to toggle the search and enjoy
</div>
<br />
<table id="s1list"></table>
<div id="s1pager"></div>
<script src="search1.js" type="text/javascript"> </script>
<br />
<div style="font-size:12px;">
<b> HTML </b>
<XMP>
...
<table id="s1list"></table>
<div id="s1pager"></div>
<script src="search1.js" type="text/javascript"> </script>
</XMP>
<b>Java Scrpt code</b>
<XMP>
...
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");
}
}
});
</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;
$wh = "";
$searchOn = Strip($_REQUEST['_search']);
if($searchOn=='true') {
$sarr = Strip($_REQUEST);
foreach( $sarr as $k=>$v) {
switch ($k) {
case 'id':
case 'invdate':
case 'name':
case 'note':
$wh .= " AND ".$k." LIKE '".$v."%'";
break;
case 'amount':
case 'tax':
case 'total':
$wh .= " AND ".$k." = ".$v;
break;
}
}
}
//echo $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 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;
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); // coment if php 5
//echo json_encode($responce);
break;
case 3:
}
mysql_close($db);
...
</XMP>
</div> | zzh-simple-hr | ZJs/webapp/grid/jqgrid/demo40/search1.html | HTML | art | 4,268 |
jQuery("#jsonopt").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:10,
rowList:[10,20,30],
pager: '#pjopt',
sortname: 'id',
viewrecords: true,
sortorder: "desc",
jsonReader: {
repeatitems : true,
cell:"",
id: "0"
},
caption: "Data Optimization",
height: 210
});
jQuery("#jsonopt").jqGrid('navGrid','#pjopt',{edit:false,add:false,del:false});
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/demo40/jsonopt.js | JavaScript | art | 896 |
<div style="font-size:12px">
This a real world example. Here we demonstarte a new feature of the formatter where the check box can be edited.<br>
Point to column Enabled and right click a mouse. Mark or unmark child nodes.<br>
We achive this using the context menu plugin from Chris Domigan.<br>
Note: This will not work in Opera browsers, since Opera does not support context menu
</div>
<br />
<table id="treegrid2"></table>
<div id="ptreegrid2"></div>
<div class="contextMenu" id="myMenu1" style="display: none;">
<ul>
<li id="mchild">Mark Childs</li>
<li id="umchild">Unmark Child</li>
</ul>
</div>
<script src="treegridadv.js" type="text/javascript"> </script>
<br />
<br>
<br>
<div style="font-size:12px">
<b> HTML </b>
<XMP>
...
<table id="treegrid"></table>
<div id="ptreegrid"></div>
<script src="treegrid.js" type="text/javascript"> </script>
</XMP>
<b>Java Scrpt code</b>
<XMP>
...
jQuery("#treegrid2").jqGrid({
url: 'server.php?q=tree2',
treedatatype: "xml",
mtype: "POST",
colNames:["id","Account","Acc Num", "Debit", "Credit","Balance","Enabled"],
colModel:[
{name:'id',index:'id', width:1,hidden:true,key:true},
{name:'name1',index:'name', width:180},
{name:'num',index:'acc_num', width:80, align:"center"},
{name:'debit',index:'debit', width:80, align:"right"},
{name:'credit',index:'credit', width:80,align:"right"},
{name:'balance',index:'balance', width:80,align:"right"},
{name:'enbl', index:'enbl', width: 60, align:'center', formatter:'checkbox', editoptions:{value:'1:0'}, formatoptions:{disabled:false}}
],
height:'auto',
pager : "#ptreegrid2",
treeGrid: true,
ExpandColumn : 'name1',
caption: "Treegrid example"
});
var ci,rowid,ptr,td;
$('#treegrid2').contextMenu('myMenu1', {
bindings: {
'mchild': function(t) {
if(ptr && rowid && ci >=1) {
var gcn = $("#treegrid2").getFullTreeNode(ptr);
$(gcn).each(function(i,v){
$("td:eq("+ci+")",this).each(function(){
if(!$("input[type='checkbox']",this).attr("checked")) {
$(this).toggleClass("changed");
$("input[type='checkbox']",this).attr("defaultChecked",true).attr("checked","checked");
}
});
});
ptr = rowid=ci=null;
}
},
'umchild': function(t) {
if(ptr && rowid && ci >=1) {
var gcn = $("#treegrid2").getFullTreeNode(ptr);
$(gcn).each(function(){
$("td:eq("+ci+")",this).each(function(){
if($("input[type='checkbox']",this).attr("checked")) {
$(this).toggleClass("changed");
$("input[type='checkbox']",this).removeAttr("checked").attr("defaultChecked","");
}
});
});
ptr = rowid=ci=null;
}
}
},
onContextMenu: function(e, menu) {
td = e.target || e.srcElement;
ptr = $(td).parents("tr.jqgrow")[0];
ci = !$(td).is('td') ? $(td).parents("td:first")[0].cellIndex : td.cellIndex;
if($.browser.msie) {
ci = $.getAbsoluteIndex(ptr,ci);
}
if( ci >=1 ) {
rowid = ptr.id;
$('#treegrid2').setSelection(rowid,false);
return true;
} else {
//alert(ptr.id+" : "+ptr.rowIndex+" : "+ci);
return false;
}
}
});
$("#jqContextMenu").addClass("ui-widget ui-widget-content").css("font-size","12px");
</XMP>
<b> PHP code </b>
<XMP>
$node = (integer)$_REQUEST["nodeid"];
// detect if here we post the data from allready loaded tree
// we can make here other checks
// load at once grid
$SQL = "SELECT account_id, name, acc_num, debit, credit, balance, level, lft, rgt FROM accounts ORDER BY lft";
$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>1</page>";
echo "<total>1</total>";
echo "<records>1</records>";
// be sure to put text data in CDATA
while($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
echo "<row>";
echo "<cell>". $row[account_id]."</cell>";
echo "<cell>". $row[name]."</cell>";
echo "<cell>". $row[acc_num]."</cell>";
echo "<cell>". $row[debit]."</cell>";
echo "<cell>". $row[credit]."</cell>";
echo "<cell>". $row[balance]."</cell>";
echo "<cell>". rand(0,1)."</cell>";
echo "<cell>". $row[level]."</cell>";
echo "<cell>". $row[lft]."</cell>";
echo "<cell>". $row[rgt]."</cell>";
if($row[rgt] == $row[lft]+1) $leaf = 'true';else $leaf='false';
echo "<cell>".$leaf."</cell>";
echo "<cell>false</cell>";
echo "</row>";
}
echo "</rows>";
</XMP>
</div> | zzh-simple-hr | ZJs/webapp/grid/jqgrid/demo40/treegridadv.html | HTML | art | 4,820 |
<div style="font-size:12px;">
This example show how we can add dialog for data editing.<br/>
See below for all available options. <br/>
Note: The data is not saved to the server<br/>
</div>
<br />
<table id="editgrid"></table>
<div id="pagered"></div>
<input type="BUTTON" id="bedata" value="Edit Selected" />
<script src="editing.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('editGridRow', the_row_id, options );
</code>
<br/>
<b>the_row_id</b> is the row to edit <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>addCaption: "Add Record"</b>,the caption of the dialog if the mode is adding<br/>
<b>editCaption: "Edit Record"</b>,the caption of the dialog if the mode is editing<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>processData: "Processing..."</b>, Indicator when posting data<br/>
<b>closeAfterAdd : false</b>, when add mode closes the dialog after add record - default false<br/>
<b>clearAfterAdd : true</b>, when add mode clears the data after adding data - default true<br/>
<b>closeAfterEdit : false</b>, when in edit mode closes the dialog after editing - default false<br/>
<b>reloadAfterSubmit : true</b> reloads grid data after posting default is true <br/>
// <i>Events</i> <br/>
<b>intializeForm: null</b> fires only once when creating the data for editing and adding.<br/>
Paramter passed to the event is the id of the constructed form.<br/>
<b>beforeInitData: null</b> fires before initialize the form data.<br/>
Paramter passed to the event is the id of the constructed form.<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 array of type name:value. 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 name:value<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("#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");
});
</XMP>
</div> | zzh-simple-hr | ZJs/webapp/grid/jqgrid/demo40/editing.html | HTML | art | 5,138 |
<div style="font-size:12px;">
This example show navigator.<br/>
See below for all available options. <br/>
Note: The data is not saved to the server<br/>
</div>
<br />
<table id="navgrid"></table>
<div id="pagernav"></div>
<script src="navgrid.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("#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
);
</XMP>
</div> | zzh-simple-hr | ZJs/webapp/grid/jqgrid/demo40/navgrid.html | HTML | art | 2,217 |
<table id="xlist1"></table>
<div id="xpager1"></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("Couldnt 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("#xlist1").jqGrid({
url:'server.php?q=1',
datatype: "xml",
toppager: true,
loadonce:true,
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", summaryType:'sum'},
{name:'note',index:'note', width:150, sortable:false}
],
rowNum:20,
autowidth: true,
rowList:[10,20,30],
pager: '#xpager1',
sortname: 'id',
viewrecords: true,
sortorder: "desc",
caption:"XML Grouping Example",
grouping: true,
groupingView : {
groupField : ['name'],
groupColumnShow : [true],
groupText : ['<b>{0}</b>'],
groupCollapse : false,
groupOrder: ['asc'],
groupSummary : [true],
groupDataSorted : true
}
});
jQuery("#list1").jqGrid('navGrid','#pager1',{edit:false,add:false,del:false});
});
</script>
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/demo40/xmlex2.html | HTML | art | 4,522 |
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});
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/demo40/40subgrid2.js | JavaScript | art | 2,082 |
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
); | zzh-simple-hr | ZJs/webapp/grid/jqgrid/demo40/navgrid2.js | JavaScript | art | 1,777 |
<div style="font-size:12px;">
This example demonstrates using a grid as subgrid.<br>
</div>
<br />
<table id="listsg11"></table>
<div id="pagersg11"></div>
<script src="subgrid_grid.js" type="text/javascript"> </script>
<br />
<div style="font-size:12px;">
<b> HTML </b>
<XMP>
...
<table id="listsg11"></table>
<div id="pagersg11"></div>
<script src="subgrid_grid.js" type="text/javascript"> </script>
</XMP>
<b>Java Scrpt code</b>
<XMP>
jQuery("#listsg11").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: '#pagersg11',
sortname: 'id',
viewrecords: true,
sortorder: "desc",
multiselect: false,
subGrid: true,
caption: "Grid as Subgrid",
subGridRowExpanded: function(subgrid_id, row_id) {
// we pass two parameters
// subgrid_id is a id of the div tag created whitin a table data
// the id of this elemenet is a combination of the "sg_" + id of the row
// the row_id is the id of the row
// If we wan to pass additinal parameters to the url we can use
// a method getRowData(row_id) - which returns associative array in type name-value
// here we can easy construct the flowing
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})
},
subGridRowColapsed: function(subgrid_id, row_id) {
// this function is called before removing the data
//var subgrid_table_id;
//subgrid_table_id = subgrid_id+"_t";
//jQuery("#"+subgrid_table_id).remove();
}
});
jQuery("#listsg11").jqGrid('navGrid','#pagersg11',{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("Couldnt 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("Couldnt 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_grid.html | HTML | art | 6,105 |
jQuery("#list13").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: '#pager13',
sortname: 'id',
viewrecords: true,
sortorder: "desc",
multiselect: true,
multikey: "ctrlKey",
caption: "Multiselect Example",
editurl:"someurl.php"
});
jQuery("#cm1").click( function() {
var s;
s = jQuery("#list13").jqGrid('getGridParam','selarrrow');
alert(s);
});
jQuery("#cm1s").click( function() {
jQuery("#list13").jqGrid('setSelection',"13");
});
jQuery("#list13").jqGrid('navGrid','#pager13',{add:false,edit:false,del:false},
{}, // edit parameters
{}, // add parameters
{reloadAfterSubmit:false} //delete parameters
); | zzh-simple-hr | ZJs/webapp/grid/jqgrid/demo40/cmultiex.js | JavaScript | art | 1,189 |
<div style="font-size:12px;">
The Query from the search can be shown to the user.
</div>
<br />
<table id="grps1"></table>
<div id="pgrps1"></div>
<script src="40grpsearch1.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("#grps1").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, searchtype:"integer"},
{name:'invdate',index:'invdate', width:90},
{name:'name', index:'name', width:100},
{name:'amount',index:'amount', width:80, align:"right", searchtype:"number"},
{name:'tax',index:'tax', width:80, align:"right", searchtype:"number"},
{name:'total',index:'total', width:80,align:"right", searchtype:"number"},
{name:'note',index:'note', width:150, sortable:false}
],
rowNum:10,
width:700,
rowList:[10,20,30],
pager: '#pgrps1',
sortname: 'invdate',
viewrecords: true,
sortorder: "desc",
jsonReader: {
repeatitems : false
},
caption: "Show query in search",
height: '100%'
});
jQuery("#grps1").jqGrid('navGrid','#pgrps1',
{edit:false,add:false,del:false},
{},
{},
{},
{multipleSearch:true, multipleGroup:true, showQuery: true}
);
</XMP>
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/demo40/40grpsearch1.html | HTML | art | 1,445 |
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});
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/demo40/38remote3.js | JavaScript | art | 1,483 |
<div style="font-size:12px;">
This example show that only certain columns can be resizable using the new property <b>resizable</b> in colModel <br>
In this case resizable are only columns: Client and Total.
</div>
<br />
<table id="list16"></table>
<div id="pager16"></div>
<script src="resizecol.js" type="text/javascript"> </script>
<br />
<div style="font-size:12px;">
<b> HTML </b>
<XMP>
...
<table id="list16"></table>
<div id="pager16"></div>
</XMP>
<b>Java Scrpt code</b>
<XMP>
...
jQuery("#list16").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, resizable:false},
{name:'invdate',index:'invdate', width:90,resizable:false},
{name:'name',index:'name', width:100},
{name:'amount',index:'amount', width:80, align:"right",resizable:false},
{name:'tax',index:'tax', width:80, align:"right",resizable:false},
{name:'total',index:'total', width:80,align:"right"},
{name:'note',index:'note', width:150, sortable:false,resizable:false}
],
rowNum:10,
rowList:[10,20,30],
pager: '#pager16',
sortname: 'id',
viewrecords: true,
sortorder: "desc",
caption: "Resizable columns"
});
jQuery("#list16").jqGrid('navGrid',"#pager16",{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/resizecol.html | HTML | art | 2,959 |
<div style="font-size:12px;">
With predefined formatter actions it is quite easy to add inline editing
</div>
<br />
<table id="frmac"></table>
<div id="pfrmac"></div>
<script src="40frmactions.js" type="text/javascript"> </script>
<br />
<div style="font-size:12px;">
<b> HTML </b>
<XMP>
<table id="frmac"></table>
<div id="pfrmac"></div>
</XMP>
<b>Java Scrpt code</b>
<XMP>
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});
</XMP>
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/demo40/40frmactions.html | HTML | art | 1,521 |
<div style="font-size:12px;">
This example show how we can load JSON data with custom data type functon <br>
i.e. the data is obtained not with the url parameter but with custom function.
</div>
<br />
<table id="listdt"></table>
<div id="pagerdt"></div>
<script src="datatype.js" type="text/javascript"> </script>
<br />
<div style="font-size:12px;">
<b> HTML </b>
<XMP>
...
<table id="listdt"></table>
<div id="pagerdt"></div>
<script src="datatype.js" type="text/javascript"> </script>
</XMP>
<b>Java Scrpt code</b>
<XMP>
...
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});
</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/datatype.html | HTML | art | 3,448 |
<div style="font-size:12px;">
From now jqGrid can accept XML and JSON data with arbitrary structure. In this release we introduce a xmlReader and jsonReader.<br>
This way we can analyze and display a wide range of data structures. More information will be<br>
available in the upcoming documentation.<br>
<a href="books.xml" target="_blank"> View the book.xml file </a>
</div>
<br />
<table id="list19"></table>
<script src="xmlmap.js" type="text/javascript"> </script>
<br />
<div style="font-size:12px;">
<b> HTML </b>
<XMP>
...
<table id="list19"></table>
<script src="xmlmap.js" type="text/javascript"> </script>
</XMP>
<b>Java Scrpt code</b>
<XMP>
...
jQuery("#list19").jqGrid({
url: 'books.xml',
datatype: "xml",
colNames:["Author","Title", "Price", "Published Date"],
colModel:[
{name:"Author",index:"Author", width:120, xmlmap:"ItemAttributes>Author"},
{name:"Title",index:"Title", width:180,xmlmap:"ItemAttributes>Title"},
{name:"Price",index:"Manufacturer", width:100, align:"right",xmlmap:"ItemAttributes>Price", sorttype:"float"},
{name:"DatePub",index:"ProductGroup", width:130,xmlmap:"ItemAttributes>DatePub",sorttype:"date"}
],
height:250,
rowNum:10,
rowList:[10,20,30],
viewrecords: true,
loadonce: true,
xmlReader: {
root : "Items",
row: "Item",
repeatitems: false,
id: "ASIN"
},
caption: "XML Mapping example"
});
</XMP>
</div> | zzh-simple-hr | ZJs/webapp/grid/jqgrid/demo40/xmlmap.html | HTML | art | 1,459 |
jQuery("#ttogrid").click(function (){
tableToGrid("#mytable");
}); | zzh-simple-hr | ZJs/webapp/grid/jqgrid/demo40/tbltogrid.js | JavaScript | art | 69 |
;(function($){
/**
* jqGrid Ukrainian Translation v1.0 02.07.2009
* Sergey Dyagovchenko
* http://d.sumy.ua
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
**/
$.jgrid = {
defaults : {
recordtext: "Перегляд {0} - {1} з {2}",
emptyrecords: "Немає записів для перегляду",
loadtext: "Завантаження...",
pgtext : "Стор. {0} з {1}"
},
search : {
caption: "Пошук...",
Find: "Знайти",
Reset: "Скидання",
odata : ['рівно', 'не рівно', 'менше', 'менше або рівне','більше','більше або рівне', 'починається з','не починається з','знаходиться в','не знаходиться в','закінчується на','не закінчується на','містить','не містить'],
groupOps: [ { op: "AND", text: "все" }, { op: "OR", text: "будь-який" } ],
matchText: " збігається",
rulesText: " правила"
},
edit : {
addCaption: "Додати запис",
editCaption: "Змінити запис",
bSubmit: "Зберегти",
bCancel: "Відміна",
bClose: "Закрити",
saveData: "До данних були внесені зміни! Зберегти зміни?",
bYes : "Так",
bNo : "Ні",
bExit : "Відміна",
msg: {
required:"Поле є обов'язковим",
number:"Будь ласка, введіть правильне число",
minValue:"значення повинне бути більше або дорівнює",
maxValue:"значення повинно бути менше або дорівнює",
email: "некоректна адреса електронної пошти",
integer: "Будь ласка, введення дійсне ціле значення",
date: "Будь ласка, введення дійсне значення дати",
url: "не дійсний URL. Необхідна приставка ('http://' or 'https://')",
nodefined : " is not defined!",
novalue : " return value is required!",
customarray : "Custom function should return array!",
customfcheck : "Custom function should be present in case of custom checking!"
}
},
view : {
caption: "Переглянути запис",
bClose: "Закрити"
},
del : {
caption: "Видалити",
msg: "Видалити обраний запис(и)?",
bSubmit: "Видалити",
bCancel: "Відміна"
},
nav : {
edittext: " ",
edittitle: "Змінити вибраний запис",
addtext:" ",
addtitle: "Додати новий запис",
deltext: " ",
deltitle: "Видалити вибраний запис",
searchtext: " ",
searchtitle: "Знайти записи",
refreshtext: "",
refreshtitle: "Оновити таблицю",
alertcap: "Попередження",
alerttext: "Будь ласка, виберіть запис",
viewtext: "",
viewtitle: "Переглянути обраний запис"
},
col : {
caption: "Показати/Приховати стовпці",
bSubmit: "Зберегти",
bCancel: "Відміна"
},
errors : {
errcap : "Помилка",
nourl : "URL не задан",
norecords: "Немає записів для обробки",
model : "Число полів не відповідає числу стовпців таблиці!"
},
formatter : {
integer : {thousandsSeparator: " ", defaultValue: '0'},
number : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0,00'},
currency : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'},
date : {
dayNames: [
"Нд", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб",
"Неділя", "Понеділок", "Вівторок", "Середа", "Четвер", "П'ятниця", "Субота"
],
monthNames: [
"Січ", "Лют", "Бер", "Кві", "Тра", "Чер", "Лип", "Сер", "Вер", "Жов", "Лис", "Гру",
"Січень", "Лютий", "Березень", "Квітень", "Травень", "Червень", "Липень", "Серпень", "Вересень", "Жовтень", "Листопад", "Грудень"
],
AmPm : ["am","pm","AM","PM"],
S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
srcformat: 'Y-m-d',
newformat: 'd.m.Y',
masks : {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
ShortDate: "n.j.Y",
LongDate: "l, F d, Y",
FullDateTime: "l, F d, Y G:i:s",
MonthDay: "F d",
ShortTime: "G:i",
LongTime: "G:i:s",
SortableDateTime: "Y-m-d\\TH:i:s",
UniversalSortableDateTime: "Y-m-d H:i:sO",
YearMonth: "F, Y"
},
reformatAfterEdit : false
},
baseLinkUrl: '',
showAction: '',
target: '',
checkbox : {disabled:true},
idName : 'id'
}
};
})(jQuery);
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/3.8.2/js/i18n/grid.locale-ua.js | JavaScript | art | 5,470 |
;(function($){
/**
* jqGrid Catalan Translation
* Traducció jqGrid en Catatà per Faserline, S.L.
* http://www.faserline.com
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
**/
$.jgrid = {
defaults : {
recordtext: "Mostrant {0} - {1} de {2}",
emptyrecords: "Sense registres que mostrar",
loadtext: "Carregant...",
pgtext : "Pàgina {0} de {1}"
},
search : {
caption: "Cerca...",
Find: "Cercar",
Reset: "Buidar",
odata : ['equal', 'not equal', 'less', 'less or equal','greater','greater or equal', 'begins with','does not begin with','is in','is not in','ends with','does not end with','contains','does not contain'],
groupOps: [ { op: "AND", text: "tot" }, { op: "OR", text: "qualsevol" } ],
matchText: " match",
rulesText: " rules"
},
edit : {
addCaption: "Afegir registre",
editCaption: "Modificar registre",
bSubmit: "Guardar",
bCancel: "Cancelar",
bClose: "Tancar",
saveData: "Les dades han canviat. Guardar canvis?",
bYes : "Yes",
bNo : "No",
bExit : "Cancel",
msg: {
required:"Camp obligatori",
number:"Introdueixi un nombre",
minValue:"El valor ha de ser major o igual que ",
maxValue:"El valor ha de ser menor o igual a ",
email: "no és una direcció de correu vàlida",
integer: "Introdueixi un valor enter",
date: "Introdueixi una data correcta ",
url: "no és una URL vàlida. Prefix requerit ('http://' or 'https://')",
nodefined : " is not defined!",
novalue : " return value is required!",
customarray : "Custom function should return array!",
customfcheck : "Custom function should be present in case of custom checking!"
}
},
view : {
caption: "Veure registre",
bClose: "Tancar"
},
del : {
caption: "Eliminar",
msg: "¿Desitja eliminar els registres seleccionats?",
bSubmit: "Eliminar",
bCancel: "Cancelar"
},
nav : {
edittext: " ",
edittitle: "Modificar fila seleccionada",
addtext:" ",
addtitle: "Agregar nova fila",
deltext: " ",
deltitle: "Eliminar fila seleccionada",
searchtext: " ",
searchtitle: "Cercar informació",
refreshtext: "",
refreshtitle: "Refrescar taula",
alertcap: "Avís",
alerttext: "Seleccioni una fila",
viewtext: " ",
viewtitle: "Veure fila seleccionada"
},
// setcolumns module
col : {
caption: "Mostrar/ocultar columnes",
bSubmit: "Enviar",
bCancel: "Cancelar"
},
errors : {
errcap : "Error",
nourl : "No s'ha especificat una URL",
norecords: "No hi ha dades per processar",
model : "Les columnes de noms són diferents de les columnes del model"
},
formatter : {
integer : {thousandsSeparator: ".", defaultValue: '0'},
number : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, defaultValue: '0,00'},
currency : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'},
date : {
dayNames: [
"Dg", "Dl", "Dt", "Dc", "Dj", "Dv", "Ds",
"Diumenge", "Dilluns", "Dimarts", "Dimecres", "Dijous", "Divendres", "Dissabte"
],
monthNames: [
"Gen", "Febr", "Març", "Abr", "Maig", "Juny", "Jul", "Ag", "Set", "Oct", "Nov", "Des",
"Gener", "Febrer", "Març", "Abril", "Maig", "Juny", "Juliol", "Agost", "Setembre", "Octubre", "Novembre", "Desembre"
],
AmPm : ["am","pm","AM","PM"],
S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
srcformat: 'Y-m-d',
newformat: 'd-m-Y',
masks : {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
ShortDate: "n/j/Y",
LongDate: "l, F d, Y",
FullDateTime: "l, F d, Y g:i:s A",
MonthDay: "F d",
ShortTime: "g:i A",
LongTime: "g:i:s A",
SortableDateTime: "Y-m-d\\TH:i:s",
UniversalSortableDateTime: "Y-m-d H:i:sO",
YearMonth: "F, Y"
},
reformatAfterEdit : false
},
baseLinkUrl: '',
showAction: 'show',
target: '',
checkbox : {disabled:true},
idName : 'id'
}
};
})(jQuery);
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/3.8.2/js/i18n/grid.locale-cat.js | JavaScript | art | 4,260 |
;(function($){
/**
* jqGrid Hebrew Translation
* Shuki Shukrun shukrun.shuki@gmail.com
* http://trirand.com/blog/
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
**/
$.jgrid = {
defaults : {
recordtext: "מציג {0} - {1} מתוך {2}",
emptyrecords: "אין רשומות להציג",
loadtext: "טוען...",
pgtext : "דף {0} מתוך {1}"
},
search : {
caption: "מחפש...",
Find: "חפש",
Reset: "התחל",
odata : ['שווה', 'לא שווה', 'קטן', 'קטן או שווה','גדול','גדול או שווה', 'מתחיל ב','לא מתחיל ב','נמצא ב','לא נמצא ב','מסתיים ב','לא מסתיים ב','מכיל','לא מכיל'],
groupOps: [ { op: "AND", text: "הכל" }, { op: "OR", text: "אחד מ" } ],
matchText: " תואם",
rulesText: " חוקים"
},
edit : {
addCaption: "הוסף רשומה",
editCaption: "ערוך רשומה",
bSubmit: "שלח",
bCancel: "בטל",
bClose: "סגור",
saveData: "נתונים השתנו! לשמור?",
bYes : "כן",
bNo : "לא",
bExit : "בטל",
msg: {
required:"שדה חובה",
number:"אנא, הכנס מספר תקין",
minValue:"ערך צריך להיות גדול או שווה ל ",
maxValue:"ערך צריך להיות קטן או שווה ל ",
email: "היא לא כתובת איימל תקינה",
integer: "אנא, הכנס מספר שלם",
date: "אנא, הכנס תאריך תקין",
url: "הכתובת אינה תקינה. דרושה תחילית ('http://' או 'https://')",
nodefined : " is not defined!",
novalue : " return value is required!",
customarray : "Custom function should return array!",
customfcheck : "Custom function should be present in case of custom checking!"
}
},
view : {
caption: "הצג רשומה",
bClose: "סגור"
},
del : {
caption: "מחק",
msg: "האם למחוק את הרשומה/ות המסומנות?",
bSubmit: "מחק",
bCancel: "בטל"
},
nav : {
edittext: "",
edittitle: "ערוך שורה מסומנת",
addtext:"",
addtitle: "הוסף שורה חדשה",
deltext: "",
deltitle: "מחק שורה מסומנת",
searchtext: "",
searchtitle: "חפש רשומות",
refreshtext: "",
refreshtitle: "טען גריד מחדש",
alertcap: "אזהרה",
alerttext: "אנא, בחר שורה",
viewtext: "",
viewtitle: "הצג שורה מסומנת"
},
col : {
caption: "הצג/הסתר עמודות",
bSubmit: "שלח",
bCancel: "בטל"
},
errors : {
errcap : "שגיאה",
nourl : "לא הוגדרה כתובת url",
norecords: "אין רשומות לעבד",
model : "אורך של colNames <> colModel!"
},
formatter : {
integer : {thousandsSeparator: " ", defaultValue: '0'},
number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'},
currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'},
date : {
dayNames: [
"א", "ב", "ג", "ד", "ה", "ו", "ש",
"ראשון", "שני", "שלישי", "רביעי", "חמישי", "שישי", "שבת"
],
monthNames: [
"ינו", "פבר", "מרץ", "אפר", "מאי", "יונ", "יול", "אוג", "ספט", "אוק", "נוב", "דצמ",
"ינואר", "פברואר", "מרץ", "אפריל", "מאי", "יוני", "יולי", "אוגוסט", "ספטמבר", "אוקטובר", "נובמבר", "דצמבר"
],
AmPm : ["לפני הצהרים","אחר הצהרים","לפני הצהרים","אחר הצהרים"],
S: function (j) {return j < 11 || j > 13 ? ['', '', '', ''][Math.min((j - 1) % 10, 3)] : ''},
srcformat: 'Y-m-d',
newformat: 'd/m/Y',
masks : {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
ShortDate: "n/j/Y",
LongDate: "l, F d, Y",
FullDateTime: "l, F d, Y g:i:s A",
MonthDay: "F d",
ShortTime: "g:i A",
LongTime: "g:i:s A",
SortableDateTime: "Y-m-d\\TH:i:s",
UniversalSortableDateTime: "Y-m-d H:i:sO",
YearMonth: "F, Y"
},
reformatAfterEdit : false
},
baseLinkUrl: '',
showAction: '',
target: '',
checkbox : {disabled:true},
idName : 'id'
}
};
})(jQuery);
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/3.8.2/js/i18n/grid.locale-he.js | JavaScript | art | 4,455 |
;(function($){
/**
* jqGrid Spanish Translation
* Traduccion jqGrid en Español por Yamil Bracho
* Traduccion corregida y ampliada por Faserline, S.L.
* http://www.faserline.com
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
**/
$.jgrid = {
defaults : {
recordtext: "Mostrando {0} - {1} de {2}",
emptyrecords: "Sin registros que mostrar",
loadtext: "Cargando...",
pgtext : "Página {0} de {1}"
},
search : {
caption: "Búsqueda...",
Find: "Buscar",
Reset: "Limpiar",
odata : ['igual ', 'no igual a', 'menor que', 'menor o igual que','mayor que','mayor o igual a', 'empiece por','no empiece por','está en','no está en','termina por','no termina por','contiene','no contiene'],
groupOps: [ { op: "AND", text: "todo" }, { op: "OR", text: "cualquier" } ],
matchText: " match",
rulesText: " reglas"
},
edit : {
addCaption: "Agregar registro",
editCaption: "Modificar registro",
bSubmit: "Guardar",
bCancel: "Cancelar",
bClose: "Cerrar",
saveData: "Se han modificado los datos, ¿guardar cambios?",
bYes : "Si",
bNo : "No",
bExit : "Cancelar",
msg: {
required:"Campo obligatorio",
number:"Introduzca un número",
minValue:"El valor debe ser mayor o igual a ",
maxValue:"El valor debe ser menor o igual a ",
email: "no es una dirección de correo válida",
integer: "Introduzca un valor entero",
date: "Introduza una fecha correcta ",
url: "no es una URL válida. Prefijo requerido ('http://' or 'https://')",
nodefined : " no está definido.",
novalue : " valor de retorno es requerido.",
customarray : "La función personalizada debe devolver un array.",
customfcheck : "La función personalizada debe estar presente en el caso de validación personalizada."
}
},
view : {
caption: "Consultar registro",
bClose: "Cerrar"
},
del : {
caption: "Eliminar",
msg: "¿Desea eliminar los registros seleccionados?",
bSubmit: "Eliminar",
bCancel: "Cancelar"
},
nav : {
edittext: " ",
edittitle: "Modificar fila seleccionada",
addtext:" ",
addtitle: "Agregar nueva fila",
deltext: " ",
deltitle: "Eliminar fila seleccionada",
searchtext: " ",
searchtitle: "Buscar información",
refreshtext: "",
refreshtitle: "Recargar datos",
alertcap: "Aviso",
alerttext: "Seleccione una fila",
viewtext: "",
viewtitle: "Ver fila seleccionada"
},
col : {
caption: "Mostrar/ocultar columnas",
bSubmit: "Enviar",
bCancel: "Cancelar"
},
errors : {
errcap : "Error",
nourl : "No se ha especificado una URL",
norecords: "No hay datos para procesar",
model : "Las columnas de nombres son diferentes de las columnas de modelo"
},
formatter : {
integer : {thousandsSeparator: ".", defaultValue: '0'},
number : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, defaultValue: '0,00'},
currency : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'},
date : {
dayNames: [
"Do", "Lu", "Ma", "Mi", "Ju", "Vi", "Sa",
"Domingo", "Lunes", "Martes", "Miercoles", "Jueves", "Viernes", "Sabado"
],
monthNames: [
"Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic",
"Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"
],
AmPm : ["am","pm","AM","PM"],
S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
srcformat: 'Y-m-d',
newformat: 'd-m-Y',
masks : {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
ShortDate: "n/j/Y",
LongDate: "l, F d, Y",
FullDateTime: "l, F d, Y g:i:s A",
MonthDay: "F d",
ShortTime: "g:i A",
LongTime: "g:i:s A",
SortableDateTime: "Y-m-d\\TH:i:s",
UniversalSortableDateTime: "Y-m-d H:i:sO",
YearMonth: "F, Y"
},
reformatAfterEdit : false
},
baseLinkUrl: '',
showAction: '',
target: '',
checkbox : {disabled:true},
idName : 'id'
}
};
})(jQuery);
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/3.8.2/js/i18n/grid.locale-es.js | JavaScript | art | 4,495 |
;(function($){
/**
* jqGrid Polish Translation
* Łukasz Schab
* http://FreeTree.pl
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
**/
$.jgrid = {
defaults : {
recordtext: "Pokaż {0} - {1} z {2}",
emptyrecords: "Brak rekordów do pokazania",
loadtext: "\u0142adowanie...",
pgtext : "Strona {0} z {1}"
},
search : {
caption: "Wyszukiwanie...",
Find: "Szukaj",
Reset: "Czyść",
odata : ['dok\u0142adnie', 'różne od', 'mniejsze od', 'mniejsze lub równe','większe od','większe lub równe', 'zaczyna się od','nie zaczyna się od','zawiera','nie zawiera','kończy się na','nie kończy się na','zawiera','nie zawiera'],
groupOps: [ { op: "ORAZ", text: "wszystkie" }, { op: "LUB", text: "każdy" } ],
matchText: " pasuje",
rulesText: " regu\u0142y"
},
edit : {
addCaption: "Dodaj rekord",
editCaption: "Edytuj rekord",
bSubmit: "Zapisz",
bCancel: "Anuluj",
bClose: "Zamknij",
saveData: "Dane zosta\u0142y zmienione! Zapisać zmiany?",
bYes : "Tak",
bNo : "Nie",
bExit : "Anuluj",
msg: {
required:"Pole jest wymagane",
number:"Proszę wpisać poprawną liczbę",
minValue:"wartość musi być większa lub równa",
maxValue:"wartość musi być mniejsza od",
email: "nie jest adresem e-mail",
integer: "Proszę wpisać poprawną liczbę",
date: "Proszę podaj poprawną datę",
url: "jest niew\u0142aściwym adresem URL. Pamiętaj o prefiksie ('http://' lub 'https://')",
nodefined : " is not defined!",
novalue : " return value is required!",
customarray : "Custom function should return array!",
customfcheck : "Custom function should be present in case of custom checking!"
}
},
view : {
caption: "Pokaż rekord",
bClose: "Zamknij"
},
del : {
caption: "Usuwanie",
msg: "Czy usunąć wybrany rekord(y)?",
bSubmit: "Usuń",
bCancel: "Anuluj"
},
nav : {
edittext: " ",
edittitle: "Edytuj wybrany wiersz",
addtext:" ",
addtitle: "Dodaj nowy wiersz",
deltext: " ",
deltitle: "Usuń wybrany wiersz",
searchtext: " ",
searchtitle: "Wyszukaj rekord",
refreshtext: "",
refreshtitle: "Prze\u0142aduj",
alertcap: "Uwaga",
alerttext: "Proszę wybrać wiersz",
viewtext: "",
viewtitle: "View selected row"
},
col : {
caption: "Pokaż/Ukryj kolumny",
bSubmit: "Zatwierdź",
bCancel: "Anuluj"
},
errors : {
errcap : "B\u0142ąd",
nourl : "Brak adresu url",
norecords: "Brak danych",
model : "D\u0142ugość colNames <> colModel!"
},
formatter : {
integer : {thousandsSeparator: " ", defaultValue: '0'},
number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'},
currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'},
date : {
dayNames: [
"Nie", "Pon", "Wt", "Śr", "Cz", "Pi", "So",
"Niedziela", "Poniedzia\u0142ek", "Wtorek", "Środa", "Czwartek", "Piątek", "Sobota"
],
monthNames: [
"Sty", "Lu", "Mar", "Kwie", "Maj", "Cze", "Lip", "Sie", "Wrz", "Paź", "Lis", "Gru",
"Styczeń", "Luty", "Marzec", "Kwiecień", "Maj", "Czerwiec", "Lipiec", "Sierpień", "Wrzesień", "Październik", "Listopad", "Grudzień"
],
AmPm : ["am","pm","AM","PM"],
S: function (j) {return j < 11 || j > 13 ? ['', '', '', ''][Math.min((j - 1) % 10, 3)] : ''},
srcformat: 'Y-m-d',
newformat: 'd/m/Y',
masks : {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
ShortDate: "n/j/Y",
LongDate: "l, F d, Y",
FullDateTime: "l, F d, Y g:i:s A",
MonthDay: "F d",
ShortTime: "g:i A",
LongTime: "g:i:s A",
SortableDateTime: "Y-m-d\\TH:i:s",
UniversalSortableDateTime: "Y-m-d H:i:sO",
YearMonth: "F, Y"
},
reformatAfterEdit : false
},
baseLinkUrl: '',
showAction: '',
target: '',
checkbox : {disabled:true},
idName : 'id'
}
};
})(jQuery); | zzh-simple-hr | ZJs/webapp/grid/jqgrid/3.8.2/js/i18n/grid.locale-pl.js | JavaScript | art | 4,262 |
;(function($){
/**
* jqGrid German Translation
* Version 1.0.0 (developed for jQuery Grid 3.3.1)
* Olaf Klöppel opensource@blue-hit.de
* http://blue-hit.de/
*
* Updated for jqGrid 3.8
* Andreas Flack
* http://www.contentcontrol-berlin.de
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
**/
$.jgrid = {
defaults : {
recordtext: "Zeige {0} - {1} von {2}",
emptyrecords: "Keine Datensätze vorhanden",
loadtext: "Lädt...",
pgtext : "Seite {0} von {1}"
},
search : {
caption: "Suche...",
Find: "Suchen",
Reset: "Zurücksetzen",
odata : ['gleich', 'ungleich', 'kleiner', 'kleiner gleich','größer','größer gleich', 'beginnt mit','beginnt nicht mit','ist in','ist nicht in','endet mit','endet nicht mit','enthält','enthält nicht'],
groupOps: [ { op: "AND", text: "alle" }, { op: "OR", text: "mindestens eine" } ],
matchText: " erfülle",
rulesText: " Bedingung(en)"
},
edit : {
addCaption: "Datensatz hinzufügen",
editCaption: "Datensatz bearbeiten",
bSubmit: "Speichern",
bCancel: "Abbrechen",
bClose: "Schließen",
saveData: "Daten wurden geändert! Änderungen speichern?",
bYes : "ja",
bNo : "nein",
bExit : "abbrechen",
msg: {
required:"Feld ist erforderlich",
number: "Bitte geben Sie eine Zahl ein",
minValue:"Wert muss größer oder gleich sein, als ",
maxValue:"Wert muss kleiner oder gleich sein, als ",
email: "ist keine gültige E-Mail-Adresse",
integer: "Bitte geben Sie eine Ganzzahl ein",
date: "Bitte geben Sie ein gültiges Datum ein",
url: "ist keine gültige URL. Präfix muss eingegeben werden ('http://' oder 'https://')",
nodefined : " ist nicht definiert!",
novalue : " Rückgabewert ist erforderlich!",
customarray : "Benutzerdefinierte Funktion sollte ein Array zurückgeben!",
customfcheck : "Benutzerdefinierte Funktion sollte im Falle der benutzerdefinierten Überprüfung vorhanden sein!"
}
},
view : {
caption: "Datensatz anzeigen",
bClose: "Schließen"
},
del : {
caption: "Löschen",
msg: "Ausgewählte Datensätze löschen?",
bSubmit: "Löschen",
bCancel: "Abbrechen"
},
nav : {
edittext: " ",
edittitle: "Ausgewählte Zeile editieren",
addtext:" ",
addtitle: "Neue Zeile einfügen",
deltext: " ",
deltitle: "Ausgewählte Zeile löschen",
searchtext: " ",
searchtitle: "Datensatz suchen",
refreshtext: "",
refreshtitle: "Tabelle neu laden",
alertcap: "Warnung",
alerttext: "Bitte Zeile auswählen",
viewtext: "",
viewtitle: "Ausgewählte Zeile anzeigen"
},
col : {
caption: "Spalten auswählen",
bSubmit: "Speichern",
bCancel: "Abbrechen"
},
errors : {
errcap : "Fehler",
nourl : "Keine URL angegeben",
norecords: "Keine Datensätze zu bearbeiten",
model : "colNames und colModel sind unterschiedlich lang!"
},
formatter : {
integer : {thousandsSeparator: ".", defaultValue: '0'},
number : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, defaultValue: '0,00'},
currency : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, prefix: "", suffix:" €", defaultValue: '0,00'},
date : {
dayNames: [
"So", "Mo", "Di", "Mi", "Do", "Fr", "Sa",
"Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"
],
monthNames: [
"Jan", "Feb", "Mar", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez",
"Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"
],
AmPm : ["am","pm","AM","PM"],
S: function (j) {return 'ter'},
srcformat: 'Y-m-d',
newformat: 'd.m.Y',
masks : {
ISO8601Long: "Y-m-d H:i:s",
ISO8601Short: "Y-m-d",
ShortDate: "j.n.Y",
LongDate: "l, j. F Y",
FullDateTime: "l, d. F Y G:i:s",
MonthDay: "d. F",
ShortTime: "G:i",
LongTime: "G:i:s",
SortableDateTime: "Y-m-d\\TH:i:s",
UniversalSortableDateTime: "Y-m-d H:i:sO",
YearMonth: "F Y"
},
reformatAfterEdit : false
},
baseLinkUrl: '',
showAction: '',
target: '',
checkbox : {disabled:true},
idName : 'id'
}
};
})(jQuery); | zzh-simple-hr | ZJs/webapp/grid/jqgrid/3.8.2/js/i18n/grid.locale-de.js | JavaScript | art | 4,480 |
;(function($){
/**
* jqGrid Russian Translation v1.0 02.07.2009 (based on translation by Alexey Kanaev v1.1 21.01.2009, http://softcore.com.ru)
* Sergey Dyagovchenko
* http://d.sumy.ua
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
**/
$.jgrid = {
defaults : {
recordtext: "Просмотр {0} - {1} из {2}",
emptyrecords: "Нет записей для просмотра",
loadtext: "Загрузка...",
pgtext : "Стр. {0} из {1}"
},
search : {
caption: "Поиск...",
Find: "Найти",
Reset: "Сброс",
odata : ['равно', 'не равно', 'меньше', 'меньше или равно','больше','больше или равно', 'начинается с','не начинается с','находится в','не находится в','заканчивается на','не заканчивается на','содержит','не содержит'],
groupOps: [ { op: "AND", text: "все" }, { op: "OR", text: "любой" } ],
matchText: " совпадает",
rulesText: " правила"
},
edit : {
addCaption: "Добавить запись",
editCaption: "Редактировать запись",
bSubmit: "Сохранить",
bCancel: "Отмена",
bClose: "Закрыть",
saveData: "Данные были измененны! Сохранить изменения?",
bYes : "Да",
bNo : "Нет",
bExit : "Отмена",
msg: {
required:"Поле является обязательным",
number:"Пожалуйста, введите правильное число",
minValue:"значение должно быть больше либо равно",
maxValue:"значение должно быть меньше либо равно",
email: "некорректное значение e-mail",
integer: "Пожалуйста, введите целое число",
date: "Пожалуйста, введите правильную дату",
url: "неверная ссылка. Необходимо ввести префикс ('http://' or 'https://')",
nodefined : " is not defined!",
novalue : " return value is required!",
customarray : "Custom function should return array!",
customfcheck : "Custom function should be present in case of custom checking!"
}
},
view : {
caption: "Просмотр записи",
bClose: "Закрыть"
},
del : {
caption: "Удалить",
msg: "Удалить выбранную запись(и)?",
bSubmit: "Удалить",
bCancel: "Отмена"
},
nav : {
edittext: " ",
edittitle: "Редактировать выбранную запись",
addtext:" ",
addtitle: "Добавить новую запись",
deltext: " ",
deltitle: "Удалить выбранную запись",
searchtext: " ",
searchtitle: "Найти записи",
refreshtext: "",
refreshtitle: "Обновить таблицу",
alertcap: "Внимание",
alerttext: "Пожалуйста, выберите запись",
viewtext: "",
viewtitle: "Просмотреть выбранную запись"
},
col : {
caption: "Показать/скрыть столбцы",
bSubmit: "Сохранить",
bCancel: "Отмена"
},
errors : {
errcap : "Ошибка",
nourl : "URL не установлен",
norecords: "Нет записей для обработки",
model : "Число полей не соответствует числу столбцов таблицы!"
},
formatter : {
integer : {thousandsSeparator: " ", defaultValue: '0'},
number : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0,00'},
currency : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'},
date : {
dayNames: [
"Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб",
"Воскресение", "Понедельник", "Вторник", "Среда", "Четверг", "Пятница", "Суббота"
],
monthNames: [
"Янв", "Фев", "Мар", "Апр", "Май", "Июн", "Июл", "Авг", "Сен", "Окт", "Ноя", "Дек",
"Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь"
],
AmPm : ["am","pm","AM","PM"],
S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
srcformat: 'Y-m-d',
newformat: 'd.m.Y',
masks : {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
ShortDate: "n.j.Y",
LongDate: "l, F d, Y",
FullDateTime: "l, F d, Y G:i:s",
MonthDay: "F d",
ShortTime: "G:i",
LongTime: "G:i:s",
SortableDateTime: "Y-m-d\\TH:i:s",
UniversalSortableDateTime: "Y-m-d H:i:sO",
YearMonth: "F, Y"
},
reformatAfterEdit : false
},
baseLinkUrl: '',
showAction: '',
target: '',
checkbox : {disabled:true},
idName : 'id'
}
};
})(jQuery);
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/3.8.2/js/i18n/grid.locale-ru.js | JavaScript | art | 5,526 |
;(function($){
/**
* jqGrid Swedish Translation
* Harald Normann harald.normann@wts.se, harald.normann@gmail.com
* http://www.worldteamsoftware.com
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
**/
$.jgrid = {
defaults : {
recordtext: "Visar {0} - {1} av {2}",
emptyrecords: "Det finns inga poster att visa",
loadtext: "Laddar...",
pgtext : "Sida {0} av {1}"
},
search : {
caption: "Sök Poster - Ange sökvillkor",
Find: "Sök",
Reset: "Nollställ Villkor",
odata : ['lika', 'ej lika', 'mindre', 'mindre eller lika','större','större eller lika', 'börjar med','börjar inte med','tillhör','tillhör inte','slutar med','slutar inte med','innehåller','innehåller inte'],
groupOps: [ { op: "AND", text: "alla" }, { op: "OR", text: "eller" } ],
matchText: " träff",
rulesText: " regler"
},
edit : {
addCaption: "Ny Post",
editCaption: "Redigera Post",
bSubmit: "Spara",
bCancel: "Avbryt",
bClose: "Stäng",
saveData: "Data har ändrats! Spara förändringar?",
bYes : "Ja",
bNo : "Nej",
bExit : "Avbryt",
msg: {
required:"Fältet är obligatoriskt",
number:"Välj korrekt nummer",
minValue:"värdet måste vara större än eller lika med",
maxValue:"värdet måste vara mindre än eller lika med",
email: "är inte korrekt e-post adress",
integer: "Var god ange korrekt heltal",
date: "Var god ange korrekt datum",
url: "är inte en korrekt URL. Prefix måste anges ('http://' or 'https://')",
nodefined : " är inte definierad!",
novalue : " returvärde måste anges!",
customarray : "Custom funktion måste returnera en vektor!",
customfcheck : "Custom funktion måste finnas om Custom kontroll sker!"
}
},
view : {
caption: "Visa Post",
bClose: "Stäng"
},
del : {
caption: "Radera",
msg: "Radera markerad(e) post(er)?",
bSubmit: "Radera",
bCancel: "Avbryt"
},
nav : {
edittext: "",
edittitle: "Redigera markerad rad",
addtext:"",
addtitle: "Skapa ny post",
deltext: "",
deltitle: "Radera markerad rad",
searchtext: "",
searchtitle: "Sök poster",
refreshtext: "",
refreshtitle: "Uppdatera data",
alertcap: "Varning",
alerttext: "Ingen rad är markerad",
viewtext: "",
viewtitle: "Visa markerad rad"
},
col : {
caption: "Välj Kolumner",
bSubmit: "OK",
bCancel: "Avbryt"
},
errors : {
errcap : "Fel",
nourl : "URL saknas",
norecords: "Det finns inga poster att bearbeta",
model : "Antal colNames <> colModel!"
},
formatter : {
integer : {thousandsSeparator: " ", defaultValue: '0'},
number : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0,00'},
currency : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"Kr", defaultValue: '0,00'},
date : {
dayNames: [
"Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör",
"Söndag", "Måndag", "Tisdag", "Onsdag", "Torsdag", "Fredag", "Lördag"
],
monthNames: [
"Jan", "Feb", "Mar", "Apr", "Maj", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec",
"Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December"
],
AmPm : ["fm","em","FM","EM"],
S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
srcformat: 'Y-m-d',
newformat: 'Y-m-d',
masks : {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
ShortDate: "n/j/Y",
LongDate: "l, F d, Y",
FullDateTime: "l, F d, Y g:i:s A",
MonthDay: "F d",
ShortTime: "g:i A",
LongTime: "g:i:s A",
SortableDateTime: "Y-m-d\\TH:i:s",
UniversalSortableDateTime: "Y-m-d H:i:sO",
YearMonth: "F, Y"
},
reformatAfterEdit : false
},
baseLinkUrl: '',
showAction: '',
target: '',
checkbox : {disabled:true},
idName : 'id'
}
};
})(jQuery);
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/3.8.2/js/i18n/grid.locale-sv.js | JavaScript | art | 4,246 |
(function(a) {
a.jgrid =
{
defaults:
{
recordtext: "regels {0} - {1} van {2}",
emptyrecords: "Geen data gevonden.",
loadtext: "laden...",
pgtext: "pagina {0} van {1}"
},
search:
{
caption: "Zoeken...",
Find: "Zoek",
Reset: "Herstellen",
odata: ["gelijk aan", "niet gelijk aan", "kleiner dan", "kleiner dan of gelijk aan", "groter dan", "groter dan of gelijk aan", "begint met", "begint niet met", "is in", "is niet in", "eindigd met", "eindigd niet met", "bevat", "bevat niet"],
groupOps: [{ op: "AND", text: "alle" }, { op: "OR", text: "een van de"}],
matchText: " match",
rulesText: " regels"
},
edit:
{
addCaption: "Nieuw",
editCaption: "Bewerken",
bSubmit: "Opslaan",
bCancel: "Annuleren",
bClose: "Sluiten",
saveData: "Er is data aangepast! Wijzigingen opslaan?",
bYes: "Ja",
bNo: "Nee",
bExit: "Sluiten",
msg:
{
required: "Veld is verplicht",
number: "Voer a.u.b. geldig nummer in",
minValue: "Waarde moet groter of gelijk zijn aan ",
maxValue: "Waarde moet kleiner of gelijks zijn aan",
email: "is geen geldig e-mailadres",
integer: "Voer a.u.b. een geldig getal in",
date: "Voer a.u.b. een geldige waarde in",
url: "is geen geldige URL. Prefix is verplicht ('http://' or 'https://')",
nodefined : " is not defined!",
novalue : " return value is required!",
customarray : "Custom function should return array!",
customfcheck : "Custom function should be present in case of custom checking!"
}
},
view:
{
caption: "Tonen",
bClose: "Sluiten"
},
del:
{
caption: "Verwijderen",
msg: "Verwijder geselecteerde regel(s)?",
bSubmit: "Verwijderen",
bCancel: "Annuleren"
},
nav:
{
edittext: "",
edittitle: "Bewerken",
addtext: "",
addtitle: "Nieuw",
deltext: "",
deltitle: "Verwijderen",
searchtext: "",
searchtitle: "Zoeken",
refreshtext: "",
refreshtitle: "Vernieuwen",
alertcap: "Waarschuwing",
alerttext: "Selecteer a.u.b. een regel",
viewtext: "",
viewtitle: "Openen"
},
col:
{
caption: "Tonen/verbergen kolommen",
bSubmit: "OK",
bCancel: "Annuleren"
},
errors:
{
errcap: "Fout",
nourl: "Er is geen URL gedefinieerd",
norecords: "Geen data om te verwerken",
model: "Lengte van 'colNames' is niet gelijk aan 'colModel'!"
},
formatter:
{
integer:
{
thousandsSeparator: ".",
defaultValue: "0"
},
number:
{
decimalSeparator: ",",
thousandsSeparator: ".",
decimalPlaces: 2,
defaultValue: "0.00"
},
currency:
{
decimalSeparator: ",",
thousandsSeparator: ".",
decimalPlaces: 2,
prefix: "EUR ",
suffix: "",
defaultValue: "0.00"
},
date:
{
dayNames: ["Zo", "Ma", "Di", "Wo", "Do", "Vr", "Za", "Zondag", "Maandag", "Dinsdag", "Woensdag", "Donderdag", "Vrijdag", "Zaterdag"],
monthNames: ["Jan", "Feb", "Maa", "Apr", "Mei", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "Januari", "Februari", "Maart", "April", "Mei", "Juni", "Juli", "Augustus", "September", "October", "November", "December"],
AmPm: ["am", "pm", "AM", "PM"],
S: function(b) {
return b < 11 || b > 13 ? ["st", "nd", "rd", "th"][Math.min((b - 1) % 10, 3)] : "th"
},
srcformat: "Y-m-d",
newformat: "d/m/Y",
masks:
{
ISO8601Long: "Y-m-d H:i:s",
ISO8601Short: "Y-m-d",
ShortDate: "n/j/Y",
LongDate: "l, F d, Y",
FullDateTime: "l d F Y G:i:s",
MonthDay: "d F",
ShortTime: "G:i",
LongTime: "G:i:s",
SortableDateTime: "Y-m-d\\TH:i:s",
UniversalSortableDateTime: "Y-m-d H:i:sO",
YearMonth: "F, Y"
},
reformatAfterEdit: false
},
baseLinkUrl: "",
showAction: "",
target: "",
checkbox:
{
disabled: true
},
idName: "id"
}
}
})(jQuery); | zzh-simple-hr | ZJs/webapp/grid/jqgrid/3.8.2/js/i18n/grid.locale-nl.js | JavaScript | art | 5,406 |
;(function ($) {
/**
* jqGrid Persian Translation
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
**/
$.jgrid = {
defaults: {
recordtext: "نمابش {0} - {1} از {2}",
emptyrecords: "رکوردی یافت نشد",
loadtext: "بارگزاري...",
pgtext: "صفحه {0} از {1}"
},
search: {
caption: "جستجو...",
Find: "يافته ها",
Reset: "از نو",
odata: ['برابر', 'نا برابر', 'به', 'کوچکتر', 'از', 'بزرگتر', 'شروع با', 'شروع نشود با', 'نباشد', 'عضو این نباشد', 'اتمام با', 'تمام نشود با', 'حاوی', 'نباشد حاوی'],
groupOps: [{
op: "AND",
text: "کل"
},
{
op: "OR",
text: "مجموع"
}],
matchText: " حاوی",
rulesText: " اطلاعات"
},
edit: {
addCaption: "اضافه کردن رکورد",
editCaption: "ويرايش رکورد",
bSubmit: "ثبت",
bCancel: "انصراف",
bClose: "بستن",
saveData: "دیتا تعییر کرد! ذخیره شود؟",
bYes: "بله",
bNo: "خیر",
bExit: "انصراف",
msg: {
required: "فيلدها بايد ختما پر شوند",
number: "لطفا عدد وعتبر وارد کنيد",
minValue: "مقدار وارد شده بايد بزرگتر يا مساوي با",
maxValue: "مقدار وارد شده بايد کوچکتر يا مساوي",
email: "پست الکترونيک وارد شده معتبر نيست",
integer: "لطفا يک عدد صحيح وارد کنيد",
date: "لطفا يک تاريخ معتبر وارد کنيد",
url: "این آدرس صحیح نمی باشد. پیشوند نیاز است ('http://' یا 'https://')",
nodefined: " تعریف نشده!",
novalue: " مقدار برگشتی اجباری است!",
customarray: "تابع شما باید مقدار آرایه داشته باشد!",
customfcheck: "برای داشتن متد دلخواه شما باید سطون با چکینگ دلخواه داشته باشید!"
}
},
view: {
caption: "نمایش رکورد",
bClose: "بستن"
},
del: {
caption: "حذف",
msg: "از حذف گزينه هاي انتخاب شده مطمئن هستيد؟",
bSubmit: "حذف",
bCancel: "ابطال"
},
nav: {
edittext: " ",
edittitle: "ويرايش رديف هاي انتخاب شده",
addtext: " ",
addtitle: "افزودن رديف جديد",
deltext: " ",
deltitle: "حذف ردبف هاي انتخاب شده",
searchtext: " ",
searchtitle: "جستجوي رديف",
refreshtext: "",
refreshtitle: "بازيابي مجدد صفحه",
alertcap: "اخطار",
alerttext: "لطفا يک رديف انتخاب کنيد",
viewtext: "",
viewtitle: "نمایش رکورد های انتخاب شده"
},
col: {
caption: "نمايش/عدم نمايش ستون",
bSubmit: "ثبت",
bCancel: "انصراف"
},
errors: {
errcap: "خطا",
nourl: "هيچ آدرسي تنظيم نشده است",
norecords: "هيچ رکوردي براي پردازش موجود نيست",
model: "طول نام ستون ها محالف ستون هاي مدل مي باشد!"
},
formatter: {
integer: {
thousandsSeparator: " ",
defaultValue: "0"
},
number: {
decimalSeparator: ".",
thousandsSeparator: " ",
decimalPlaces: 2,
defaultValue: "0.00"
},
currency: {
decimalSeparator: ".",
thousandsSeparator: " ",
decimalPlaces: 2,
prefix: "",
suffix: "",
defaultValue: "0"
},
date: {
dayNames: ["يک", "دو", "سه", "چهار", "پنج", "جمع", "شنب", "يکشنبه", "دوشنبه", "سه شنبه", "چهارشنبه", "پنجشنبه", "جمعه", "شنبه"],
monthNames: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "ژانويه", "فوريه", "مارس", "آوريل", "مه", "ژوئن", "ژوئيه", "اوت", "سپتامبر", "اکتبر", "نوامبر", "December"],
AmPm: ["ب.ظ", "ب.ظ", "ق.ظ", "ق.ظ"],
S: function (b) {
return b < 11 || b > 13 ? ["st", "nd", "rd", "th"][Math.min((b - 1) % 10, 3)] : "th"
},
srcformat: "Y-m-d",
newformat: "d/m/Y",
masks: {
ISO8601Long: "Y-m-d H:i:s",
ISO8601Short: "Y-m-d",
ShortDate: "n/j/Y",
LongDate: "l, F d, Y",
FullDateTime: "l, F d, Y g:i:s A",
MonthDay: "F d",
ShortTime: "g:i A",
LongTime: "g:i:s A",
SortableDateTime: "Y-m-d\\TH:i:s",
UniversalSortableDateTime: "Y-m-d H:i:sO",
YearMonth: "F, Y"
},
reformatAfterEdit: false
},
baseLinkUrl: "",
showAction: "نمايش",
target: "",
checkbox: {
disabled: true
},
idName: "id"
}
}
})(jQuery); | zzh-simple-hr | ZJs/webapp/grid/jqgrid/3.8.2/js/i18n/grid.locale-fa.js | JavaScript | art | 6,408 |
;(function($){
/**
* jqGrid Brazilian-Portuguese Translation
* Sergio Righi sergio.righi@gmail.com
* http://curve.com.br
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
**/
$.jgrid = {
defaults : {
recordtext: "Ver {0} - {1} of {2}",
emptyrecords: "Nenhum registro para visualizar",
loadtext: "Carregando...",
pgtext : "Página {0} de {1}"
},
search : {
caption: "Procurar...",
Find: "Procurar",
Reset: "Resetar",
odata : ['equal', 'not equal', 'less', 'less or equal','greater','greater or equal', 'begins with','does not begin with','is in','is not in','ends with','does not end with','contains','does not contain'],
groupOps: [ { op: "AND", text: "all" }, { op: "OR", text: "any" } ],
matchText: " iguala",
rulesText: " regras"
},
edit : {
addCaption: "Incluir",
editCaption: "Alterar",
bSubmit: "Enviar",
bCancel: "Cancelar",
bClose: "Fechar",
saveData: "Os dados foram alterados! Salvar alterações?",
bYes : "Sim",
bNo : "Não",
bExit : "Cancelar",
msg: {
required:"Campo obrigatório",
number:"Por favor, informe um número válido",
minValue:"valor deve ser igual ou maior que ",
maxValue:"valor deve ser menor ou igual a",
email: "este e-mail não é válido",
integer: "Por favor, informe um valor inteiro",
date: "Por favor, informe uma data válida",
url: "não é uma URL válida. Prefixo obrigatório ('http://' or 'https://')",
nodefined : " não está definido!",
novalue : " um valor de retorno é obrigatório!",
customarray : "Função customizada deve retornar um array!",
customfcheck : "Função customizada deve estar presente em caso de validação customizada!"
}
},
view : {
caption: "Ver Registro",
bClose: "Fechar"
},
del : {
caption: "Apagar",
msg: "Apagar registros selecionado(s)?",
bSubmit: "Apagar",
bCancel: "Cancelar"
},
nav : {
edittext: " ",
edittitle: "Alterar registro selecionado",
addtext:" ",
addtitle: "Incluir novo registro",
deltext: " ",
deltitle: "Apagar registro selecionado",
searchtext: " ",
searchtitle: "Procurar registros",
refreshtext: "",
refreshtitle: "Recarrgando Tabela",
alertcap: "Aviso",
alerttext: "Por favor, selecione um registro",
viewtext: "",
viewtitle: "Ver linha selecionada"
},
col : {
caption: "Mostrar/Esconder Colunas",
bSubmit: "Enviar",
bCancel: "Cancelar"
},
errors : {
errcap : "Erro",
nourl : "Nenhuma URL defenida",
norecords: "Sem registros para exibir",
model : "Comprimento de colNames <> colModel!"
},
formatter : {
integer : {thousandsSeparator: " ", defaultValue: '0'},
number : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0,00'},
currency : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, prefix: "R$ ", suffix:"", defaultValue: '0,00'},
date : {
dayNames: [
"Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sáb",
"Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado"
],
monthNames: [
"Jan", "Fev", "Mar", "Abr", "Mai", "Jun", "Jul", "Ago", "Set", "Out", "Nov", "Dez",
"Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"
],
AmPm : ["am","pm","AM","PM"],
S: function (j) {return j < 11 || j > 13 ? ['º', 'º', 'º', 'º'][Math.min((j - 1) % 10, 3)] : 'º'},
srcformat: 'Y-m-d',
newformat: 'd/m/Y',
masks : {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
ShortDate: "n/j/Y",
LongDate: "l, F d, Y",
FullDateTime: "l, F d, Y g:i:s A",
MonthDay: "F d",
ShortTime: "g:i A",
LongTime: "g:i:s A",
SortableDateTime: "Y-m-d\\TH:i:s",
UniversalSortableDateTime: "Y-m-d H:i:sO",
YearMonth: "F, Y"
},
reformatAfterEdit : false
},
baseLinkUrl: '',
showAction: '',
target: '',
checkbox : {disabled:true},
idName : 'id'
}
};
})(jQuery);
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/3.8.2/js/i18n/grid.locale-pt-br.js | JavaScript | art | 4,390 |
;(function($){
/**
* jqGrid Turkish Translation
* Erhan Gündoğan (erhan@trposta.net)
* http://blog.zakkum.com
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
**/
$.jgrid = {
defaults : {
recordtext: "{0}-{1} listeleniyor. Toplam:{2}",
emptyrecords: "Kayıt bulunamadı",
loadtext: "Yükleniyor...",
pgtext : "{0}/{1}. Sayfa"
},
search : {
caption: "Arama...",
Find: "Bul",
Reset: "Temizle",
odata : ['eşit', 'eşit değil', 'daha az', 'daha az veya eşit', 'daha fazla', 'daha fazla veya eşit', 'ile başlayan', 'ile başlamayan', 'içinde', 'içinde değil', 'ile biten', 'ile bitmeyen', 'içeren', 'içermeyen'],
groupOps: [ { op: "VE", text: "tüm" }, { op: "VEYA", text: "herhangi" } ],
matchText: " uyan",
rulesText: " kurallar"
},
edit : {
addCaption: "Kayıt Ekle",
editCaption: "Kayıt Düzenle",
bSubmit: "Gönder",
bCancel: "İptal",
bClose: "Kapat",
saveData: "Veriler değişti! Kayıt edilsin mi?",
bYes : "Evet",
bNo : "Hayıt",
bExit : "İptal",
msg: {
required:"Alan gerekli",
number:"Lütfen bir numara giriniz",
minValue:"girilen değer daha büyük ya da buna eşit olmalıdır",
maxValue:"girilen değer daha küçük ya da buna eşit olmalıdır",
email: "geçerli bir e-posta adresi değildir",
integer: "Lütfen bir tamsayı giriniz",
url: "Geçerli bir URL değil. ('http://' or 'https://') ön eki gerekli.",
nodefined : " is not defined!",
novalue : " return value is required!",
customarray : "Custom function should return array!",
customfcheck : "Custom function should be present in case of custom checking!"
}
},
view : {
caption: "Kayıt Görüntüle",
bClose: "Kapat"
},
del : {
caption: "Sil",
msg: "Seçilen kayıtlar silinsin mi?",
bSubmit: "Sil",
bCancel: "İptal"
},
nav : {
edittext: " ",
edittitle: "Seçili satırı düzenle",
addtext:" ",
addtitle: "Yeni satır ekle",
deltext: " ",
deltitle: "Seçili satırı sil",
searchtext: " ",
searchtitle: "Kayıtları bul",
refreshtext: "",
refreshtitle: "Tabloyu yenile",
alertcap: "Uyarı",
alerttext: "Lütfen bir satır seçiniz",
viewtext: "",
viewtitle: "Seçilen satırı görüntüle"
},
col : {
caption: "Sütunları göster/gizle",
bSubmit: "Gönder",
bCancel: "İptal"
},
errors : {
errcap : "Hata",
nourl : "Bir url yapılandırılmamış",
norecords: "İşlem yapılacak bir kayıt yok",
model : "colNames uzunluğu <> colModel!"
},
formatter : {
integer : {thousandsSeparator: " ", defaultValue: '0'},
number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'},
currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'},
date : {
dayNames: [
"Paz", "Pts", "Sal", "Çar", "Per", "Cum", "Cts",
"Pazar", "Pazartesi", "Salı", "Çarşamba", "Perşembe", "Cuma", "Cumartesi"
],
monthNames: [
"Oca", "Şub", "Mar", "Nis", "May", "Haz", "Tem", "Ağu", "Eyl", "Eki", "Kas", "Ara",
"Ocak", "Şubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "Ağustos", "Eylül", "Ekim", "Kasım", "Aralık"
],
AmPm : ["am","pm","AM","PM"],
S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
srcformat: 'Y-m-d',
newformat: 'd/m/Y',
masks : {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
ShortDate: "n/j/Y",
LongDate: "l, F d, Y",
FullDateTime: "l, F d, Y g:i:s A",
MonthDay: "F d",
ShortTime: "g:i A",
LongTime: "g:i:s A",
SortableDateTime: "Y-m-d\\TH:i:s",
UniversalSortableDateTime: "Y-m-d H:i:sO",
YearMonth: "F, Y"
},
reformatAfterEdit : false
},
baseLinkUrl: '',
showAction: '',
target: '',
checkbox : {disabled:true},
idName : 'id'
}
};
})(jQuery);
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/3.8.2/js/i18n/grid.locale-tr.js | JavaScript | art | 4,338 |
;(function($){
/**
* jqGrid Danish Translation
* Aesiras A/S
* http://www.aesiras.dk
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
**/
$.jgrid = {
defaults : {
recordtext: "Vis {0} - {1} of {2}",
emptyrecords: "Ingen linjer fundet",
loadtext: "Henter...",
pgtext : "Side {0} af {1}"
},
search : {
caption: "Søg...",
Find: "Find",
Reset: "Nulstil",
odata : ['lig', 'forskellige fra', 'mindre', 'mindre eller lig','større','større eller lig', 'begynder med','begynder ikke med','findes i','findes ikke i','ender med','ender ikke med','indeholder','indeholder ikke'],
groupOps: [ { op: "AND", text: "all" }, { op: "OR", text: "any" } ],
matchText: " lig",
rulesText: " regler"
},
edit : {
addCaption: "Tilføj",
editCaption: "Ret",
bSubmit: "Send",
bCancel: "Annuller",
bClose: "Luk",
saveData: "Data er ændret. Gem data?",
bYes : "Ja",
bNo : "Nej",
bExit : "Fortryd",
msg: {
required:"Felt er nødvendigt",
number:"Indtast venligst et validt tal",
minValue:"værdi skal være større end eller lig med",
maxValue:"værdi skal være mindre end eller lig med",
email: "er ikke en gyldig email",
integer: "Indtast venligst et gyldigt heltal",
date: "Indtast venligst en gyldig datoværdi",
url: "er ugyldig URL. Prefix mangler ('http://' or 'https://')",
nodefined : " er ikke defineret!",
novalue : " returværdi kræves!",
customarray : "Custom function should return array!",
customfcheck : "Custom function should be present in case of custom checking!"
}
},
view : {
caption: "Vis linje",
bClose: "Luk"
},
del : {
caption: "Slet",
msg: "Slet valgte linje(r)?",
bSubmit: "Slet",
bCancel: "Fortryd"
},
nav : {
edittext: " ",
edittitle: "Rediger valgte linje",
addtext:" ",
addtitle: "Tilføj ny linje",
deltext: " ",
deltitle: "Slet valgte linje",
searchtext: " ",
searchtitle: "Find linjer",
refreshtext: "",
refreshtitle: "Indlæs igen",
alertcap: "Advarsel",
alerttext: "Vælg venligst linje",
viewtext: "",
viewtitle: "Vis valgte linje"
},
col : {
caption: "Vis/skjul kolonner",
bSubmit: "Opdatere",
bCancel: "Fortryd"
},
errors : {
errcap : "Fejl",
nourl : "Ingen url valgt",
norecords: "Ingen linjer at behandle",
model : "colNames og colModel har ikke samme længde!"
},
formatter : {
integer : {thousandsSeparator: " ", defaultValue: '0'},
number : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0,00'},
currency : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'},
date : {
dayNames: [
"Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør",
"Søndag", "Mandag", "Tirsdag", "Onsdag", "Torsdag", "Fredag", "Lørdag"
],
monthNames: [
"Jan", "Feb", "Mar", "Apr", "Maj", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec",
"Januar", "Februar", "Marts", "April", "Maj", "Juni", "Juli", "August", "September", "Oktober", "November", "December"
],
AmPm : ["","","",""],
S: function (j) {return '.'},
srcformat: 'Y-m-d',
newformat: 'd/m/Y',
masks : {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
ShortDate: "j/n/Y",
LongDate: "l d. F Y",
FullDateTime: "l d F Y G:i:s",
MonthDay: "d. F",
ShortTime: "G:i",
LongTime: "G:i:s",
SortableDateTime: "Y-m-d\\TH:i:s",
UniversalSortableDateTime: "Y-m-d H:i:sO",
YearMonth: "F Y"
},
reformatAfterEdit : false
},
baseLinkUrl: '',
showAction: '',
target: '',
checkbox : {disabled:true},
idName : 'id'
}
};
// DA
})(jQuery);
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/3.8.2/js/i18n/grid.locale-da.js | JavaScript | art | 4,097 |
;(function($){
/**
* jqGrid Romanian Translation
* Alexandru Emil Lupu contact@alecslupu.ro
* http://www.alecslupu.ro/
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
**/
$.jgrid = {
defaults : {
recordtext: "Vizualizare {0} - {1} din {2}",
emptyrecords: "Nu există înregistrări de vizualizat",
loadtext: "Încărcare...",
pgtext : "Pagina {0} din {1}"
},
search : {
caption: "Caută...",
Find: "Caută",
Reset: "Resetare",
odata : ['egal', 'diferit', 'mai mic', 'mai mic sau egal','mai mare','mai mare sau egal', 'începe cu','nu începe cu','se găsește în','nu se găsește în','se termină cu','nu se termină cu','conține',''],
groupOps: [ { op: "AND", text: "toate" }, { op: "OR", text: "oricare" } ],
matchText: " găsite",
rulesText: " reguli"
},
edit : {
addCaption: "Adăugare înregistrare",
editCaption: "Modificare înregistrare",
bSubmit: "Salvează",
bCancel: "Anulare",
bClose: "Închide",
saveData: "Informațiile au fost modificate! Salvați modificările?",
bYes : "Da",
bNo : "Nu",
bExit : "Anulare",
msg: {
required:"Câmpul este obligatoriu",
number:"Vă rugăm introduceți un număr valid",
minValue:"valoarea trebuie sa fie mai mare sau egală cu",
maxValue:"valoarea trebuie sa fie mai mică sau egală cu",
email: "nu este o adresă de e-mail validă",
integer: "Vă rugăm introduceți un număr valid",
date: "Vă rugăm să introduceți o dată validă",
url: "Nu este un URL valid. Prefixul este necesar('http://' or 'https://')",
nodefined : " is not defined!",
novalue : " return value is required!",
customarray : "Custom function should return array!",
customfcheck : "Custom function should be present in case of custom checking!"
}
},
view : {
caption: "Vizualizare înregistrare",
bClose: "Închidere"
},
del : {
caption: "Ștegere",
msg: "Ștergeți înregistrarea (înregistrările) selectate?",
bSubmit: "Șterge",
bCancel: "Anulare"
},
nav : {
edittext: "",
edittitle: "Modifică rândul selectat",
addtext:"",
addtitle: "Adaugă rând nou",
deltext: "",
deltitle: "Șterge rândul selectat",
searchtext: "",
searchtitle: "Căutare înregistrări",
refreshtext: "",
refreshtitle: "Reîncarcare Grid",
alertcap: "Avertisment",
alerttext: "Vă rugăm să selectați un rând",
viewtext: "",
viewtitle: "Vizualizează rândul selectat"
},
col : {
caption: "Arată/Ascunde coloanele",
bSubmit: "Salvează",
bCancel: "Anulare"
},
errors : {
errcap : "Eroare",
nourl : "Niciun url nu este setat",
norecords: "Nu sunt înregistrări de procesat",
model : "Lungimea colNames <> colModel!"
},
formatter : {
integer : {thousandsSeparator: " ", defaultValue: '0'},
number : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0,00'},
currency : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'},
date : {
dayNames: [
"Dum", "Lun", "Mar", "Mie", "Joi", "Vin", "Sâm",
"Duminică", "Luni", "Marți", "Miercuri", "Joi", "Vineri", "Sâmbătă"
],
monthNames: [
"Ian", "Feb", "Mar", "Apr", "Mai", "Iun", "Iul", "Aug", "Sep", "Oct", "Noi", "Dec",
"Ianuarie", "Februarie", "Martie", "Aprilie", "Mai", "Iunie", "Iulie", "August", "Septembrie", "Octombrie", "Noiembrie", "Decembrie"
],
AmPm : ["am","pm","AM","PM"],
/*
Here is a problem in romanian:
M / F
1st = primul / prima
2nd = Al doilea / A doua
3rd = Al treilea / A treia
4th = Al patrulea/ A patra
5th = Al cincilea / A cincea
6th = Al șaselea / A șasea
7th = Al șaptelea / A șaptea
....
*/
S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
srcformat: 'Y-m-d',
newformat: 'd/m/Y',
masks : {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
ShortDate: "n/j/Y",
LongDate: "l, F d, Y",
FullDateTime: "l, F d, Y g:i:s A",
MonthDay: "F d",
ShortTime: "g:i A",
LongTime: "g:i:s A",
SortableDateTime: "Y-m-d\\TH:i:s",
UniversalSortableDateTime: "Y-m-d H:i:sO",
YearMonth: "F, Y"
},
reformatAfterEdit : false
},
baseLinkUrl: '',
showAction: '',
target: '',
checkbox : {disabled:true},
idName : 'id'
}
};
})(jQuery);
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/3.8.2/js/i18n/grid.locale-ro.js | JavaScript | art | 4,602 |
;(function($){
/**
* jqGrid Greek (el) Translation
* Alex Cicovic
* http://www.alexcicovic.com
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
**/
$.jgrid = {
defaults : {
recordtext: "View {0} - {1} of {2}",
emptyrecords: "No records to view",
loadtext: "Φόρτωση...",
pgtext : "Page {0} of {1}"
},
search : {
caption: "Αναζήτηση...",
Find: "Εύρεση",
Reset: "Επαναφορά",
odata : ['equal', 'not equal', 'less', 'less or equal','greater','greater or equal', 'begins with','does not begin with','is in','is not in','ends with','does not end with','contains','does not contain'],
groupOps: [ { op: "AND", text: "all" }, { op: "OR", text: "any" } ],
matchText: " match",
rulesText: " rules"
},
edit : {
addCaption: "Εισαγωγή Εγγραφής",
editCaption: "Επεξεργασία Εγγραφής",
bSubmit: "Καταχώρηση",
bCancel: "Άκυρο",
bClose: "Κλείσιμο",
saveData: "Data has been changed! Save changes?",
bYes : "Yes",
bNo : "No",
bExit : "Cancel",
msg: {
required:"Το πεδίο είναι απαραίτητο",
number:"Το πεδίο δέχεται μόνο αριθμούς",
minValue:"Η τιμή πρέπει να είναι μεγαλύτερη ή ίση του ",
maxValue:"Η τιμή πρέπει να είναι μικρότερη ή ίση του ",
email: "Η διεύθυνση e-mail δεν είναι έγκυρη",
integer: "Το πεδίο δέχεται μόνο ακέραιους αριθμούς",
url: "is not a valid URL. Prefix required ('http://' or 'https://')",
nodefined : " is not defined!",
novalue : " return value is required!",
customarray : "Custom function should return array!",
customfcheck : "Custom function should be present in case of custom checking!"
}
},
view : {
caption: "View Record",
bClose: "Close"
},
del : {
caption: "Διαγραφή",
msg: "Διαγραφή των επιλεγμένων εγγραφών;",
bSubmit: "Ναι",
bCancel: "Άκυρο"
},
nav : {
edittext: " ",
edittitle: "Επεξεργασία επιλεγμένης εγγραφής",
addtext:" ",
addtitle: "Εισαγωγή νέας εγγραφής",
deltext: " ",
deltitle: "Διαγραφή επιλεγμένης εγγραφής",
searchtext: " ",
searchtitle: "Εύρεση Εγγραφών",
refreshtext: "",
refreshtitle: "Ανανέωση Πίνακα",
alertcap: "Προσοχή",
alerttext: "Δεν έχετε επιλέξει εγγραφή",
viewtext: "",
viewtitle: "View selected row"
},
col : {
caption: "Εμφάνιση / Απόκρυψη Στηλών",
bSubmit: "ΟΚ",
bCancel: "Άκυρο"
},
errors : {
errcap : "Σφάλμα",
nourl : "Δεν έχει δοθεί διεύθυνση χειρισμού για τη συγκεκριμένη ενέργεια",
norecords: "Δεν υπάρχουν εγγραφές προς επεξεργασία",
model : "Άνισος αριθμός πεδίων colNames/colModel!"
},
formatter : {
integer : {thousandsSeparator: " ", defaultValue: '0'},
number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'},
currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'},
date : {
dayNames: [
"Κυρ", "Δευ", "Τρι", "Τετ", "Πεμ", "Παρ", "Σαβ",
"Κυριακή", "Δευτέρα", "Τρίτη", "Τετάρτη", "Πέμπτη", "Παρασκευή", "Σάββατο"
],
monthNames: [
"Ιαν", "Φεβ", "Μαρ", "Απρ", "Μαι", "Ιουν", "Ιουλ", "Αυγ", "Σεπ", "Οκτ", "Νοε", "Δεκ",
"Ιανουάριος", "Φεβρουάριος", "Μάρτιος", "Απρίλιος", "Μάιος", "Ιούνιος", "Ιούλιος", "Αύγουστος", "Σεπτέμβριος", "Οκτώβριος", "Νοέμβριος", "Δεκέμβριος"
],
AmPm : ["πμ","μμ","ΠΜ","ΜΜ"],
S: function (j) {return j == 1 || j > 1 ? ['η'][Math.min((j - 1) % 10, 3)] : ''},
srcformat: 'Y-m-d',
newformat: 'd/m/Y',
masks : {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
ShortDate: "n/j/Y",
LongDate: "l, F d, Y",
FullDateTime: "l, F d, Y g:i:s A",
MonthDay: "F d",
ShortTime: "g:i A",
LongTime: "g:i:s A",
SortableDateTime: "Y-m-d\\TH:i:s",
UniversalSortableDateTime: "Y-m-d H:i:sO",
YearMonth: "F, Y"
},
reformatAfterEdit : false
},
baseLinkUrl: '',
showAction: '',
target: '',
checkbox : {disabled:true},
idName : 'id'
}
};
})(jQuery);
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/3.8.2/js/i18n/grid.locale-el.js | JavaScript | art | 5,151 |
;(function($){
/**
* jqGrid Icelandic Translation
* jtm@hi.is Univercity of Iceland
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
**/
$.jgrid = {
defaults : {
recordtext: "View {0} - {1} of {2}",
emptyrecords: "No records to view",
loadtext: "Hleður...",
pgtext : "Page {0} of {1}"
},
search : {
caption: "Leita...",
Find: "Leita",
Reset: "Endursetja",
odata : ['equal', 'not equal', 'less', 'less or equal','greater','greater or equal', 'begins with','does not begin with','is in','is not in','ends with','does not end with','contains','does not contain'],
groupOps: [ { op: "AND", text: "all" }, { op: "OR", text: "any" } ],
matchText: " match",
rulesText: " rules"
},
edit : {
addCaption: "Add Record",
editCaption: "Edit Record",
bSubmit: "Vista",
bCancel: "Hætta við",
bClose: "Loka",
saveData: "Data has been changed! Save changes?",
bYes : "Yes",
bNo : "No",
bExit : "Cancel",
msg: {
required:"Reitur er nauðsynlegur",
number:"Vinsamlega settu inn tölu",
minValue:"gildi verður að vera meira en eða jafnt og ",
maxValue:"gildi verður að vera minna en eða jafnt og ",
email: "er ekki löglegt email",
integer: "Vinsamlega settu inn tölu",
date: "Please, enter valid date value",
url: "is not a valid URL. Prefix required ('http://' or 'https://')",
nodefined : " is not defined!",
novalue : " return value is required!",
customarray : "Custom function should return array!",
customfcheck : "Custom function should be present in case of custom checking!"
}
},
view : {
caption: "View Record",
bClose: "Close"
},
del : {
caption: "Eyða",
msg: "Eyða völdum færslum ?",
bSubmit: "Eyða",
bCancel: "Hætta við"
},
nav : {
edittext: " ",
edittitle: "Breyta færslu",
addtext:" ",
addtitle: "Ný færsla",
deltext: " ",
deltitle: "Eyða færslu",
searchtext: " ",
searchtitle: "Leita",
refreshtext: "",
refreshtitle: "Endurhlaða",
alertcap: "Viðvörun",
alerttext: "Vinsamlega veldu færslu",
viewtext: "",
viewtitle: "View selected row"
},
col : {
caption: "Sýna / fela dálka",
bSubmit: "Vista",
bCancel: "Hætta við"
},
errors : {
errcap : "Villa",
nourl : "Vantar slóð",
norecords: "Engar færslur valdar",
model : "Length of colNames <> colModel!"
},
formatter : {
integer : {thousandsSeparator: " ", defaultValue: '0'},
number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'},
currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'},
date : {
dayNames: [
"Sun", "Mon", "Tue", "Wed", "Thr", "Fri", "Sat",
"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
],
monthNames: [
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
],
AmPm : ["am","pm","AM","PM"],
S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
srcformat: 'Y-m-d',
newformat: 'd/m/Y',
masks : {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
ShortDate: "n/j/Y",
LongDate: "l, F d, Y",
FullDateTime: "l, F d, Y g:i:s A",
MonthDay: "F d",
ShortTime: "g:i A",
LongTime: "g:i:s A",
SortableDateTime: "Y-m-d\\TH:i:s",
UniversalSortableDateTime: "Y-m-d H:i:sO",
YearMonth: "F, Y"
},
reformatAfterEdit : false
},
baseLinkUrl: '',
showAction: '',
target: '',
checkbox : {disabled:true},
idName : 'id'
}
};
})(jQuery);
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/3.8.2/js/i18n/grid.locale-is.js | JavaScript | art | 4,182 |
;(function($){
/**
* jqGrid Chinese Translation for v3.6
* waiting 2010.01.18
* http://waiting.javaeye.com/
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* update 2010.05.04
* add double u3000 SPACE for search:odata to fix SEARCH box display err when narrow width from only use of eq/ne/cn/in/lt/gt operator under IE6/7
**/
$.jgrid = {
defaults : {
recordtext: "{0} - {1}\u3000共 {2} 条", // 共字前是全角空格
emptyrecords: "无数据显示",
loadtext: "读取中...",
pgtext : " {0} 共 {1} 页"
},
search : {
caption: "搜索...",
Find: "查找",
Reset: "重置",
odata : ['等于\u3000\u3000', '不等\u3000\u3000', '小于\u3000\u3000', '小于等于','大于\u3000\u3000','大于等于',
'开始于','不开始于','属于\u3000\u3000','不属于','结束于','不结束于','包含\u3000\u3000','不包含'],
groupOps: [ { op: "AND", text: "所有" }, { op: "OR", text: "任一" } ],
matchText: " 匹配",
rulesText: " 规则"
},
edit : {
addCaption: "添加记录",
editCaption: "编辑记录",
bSubmit: "提交",
bCancel: "取消",
bClose: "关闭",
saveData: "数据已改变,是否保存?",
bYes : "是",
bNo : "否",
bExit : "取消",
msg: {
required:"此字段必需",
number:"请输入有效数字",
minValue:"输值必须大于等于 ",
maxValue:"输值必须小于等于 ",
email: "这不是有效的e-mail地址",
integer: "请输入有效整数",
date: "请输入有效时间",
url: "无效网址。前缀必须为 ('http://' 或 'https://')",
nodefined : " 未定义!",
novalue : " 需要返回值!",
customarray : "自定义函数需要返回数组!",
customfcheck : "Custom function should be present in case of custom checking!"
}
},
view : {
caption: "查看记录",
bClose: "关闭"
},
del : {
caption: "删除",
msg: "删除所选记录?",
bSubmit: "删除",
bCancel: "取消"
},
nav : {
edittext: "",
edittitle: "编辑所选记录",
addtext:"",
addtitle: "添加新记录",
deltext: "",
deltitle: "删除所选记录",
searchtext: "",
searchtitle: "查找",
refreshtext: "",
refreshtitle: "刷新表格",
alertcap: "注意",
alerttext: "请选择记录",
viewtext: "",
viewtitle: "查看所选记录"
},
col : {
caption: "选择列",
bSubmit: "确定",
bCancel: "取消"
},
errors : {
errcap : "错误",
nourl : "没有设置url",
norecords: "没有要处理的记录",
model : "colNames 和 colModel 长度不等!"
},
formatter : {
integer : {thousandsSeparator: " ", defaultValue: '0'},
number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'},
currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'},
date : {
dayNames: [
"Sun", "Mon", "Tue", "Wed", "Thr", "Fri", "Sat",
"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
],
monthNames: [
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
],
AmPm : ["am","pm","AM","PM"],
S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
srcformat: 'Y-m-d',
newformat: 'm-d-Y',
masks : {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
ShortDate: "Y/j/n",
LongDate: "l, F d, Y",
FullDateTime: "l, F d, Y g:i:s A",
MonthDay: "F d",
ShortTime: "g:i A",
LongTime: "g:i:s A",
SortableDateTime: "Y-m-d\\TH:i:s",
UniversalSortableDateTime: "Y-m-d H:i:sO",
YearMonth: "F, Y"
},
reformatAfterEdit : false
},
baseLinkUrl: '',
showAction: '',
target: '',
checkbox : {disabled:true},
idName : 'id'
}
};
})(jQuery);
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/3.8.2/js/i18n/grid.locale-cn.js | JavaScript | art | 4,154 |
;(function($){
/**
* jqGrid Bulgarian Translation
* Tony Tomov tony@trirand.com
* http://trirand.com/blog/
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
**/
$.jgrid = {
defaults : {
recordtext: "{0} - {1} от {2}",
emptyrecords: "Няма запис(и)",
loadtext: "Зареждам...",
pgtext : "Стр. {0} от {1}"
},
search : {
caption: "Търсене...",
Find: "Намери",
Reset: "Изчисти",
odata : ['равно', 'различно', 'по-малко', 'по-малко или=','по-голямо','по-голямо или =', 'започва с','не започва с','се намира в','не се намира в','завършва с','не завършава с','съдържа', 'не съдържа' ],
groupOps: [ { op: "AND", text: " И " }, { op: "OR", text: "ИЛИ" } ],
matchText: " включи",
rulesText: " клауза"
},
edit : {
addCaption: "Нов Запис",
editCaption: "Редакция Запис",
bSubmit: "Запиши",
bCancel: "Изход",
bClose: "Затвори",
saveData: "Данните са променени! Да съхраня ли промените?",
bYes : "Да",
bNo : "Не",
bExit : "Отказ",
msg: {
required:"Полето е задължително",
number:"Въведете валидно число!",
minValue:"стойността трябва да е по-голяма или равна от",
maxValue:"стойността трябва да е по-малка или равна от",
email: "не е валиден ел. адрес",
integer: "Въведете валидно цяло число",
date: "Въведете валидна дата",
url: "e невалиден URL. Изискава се префикс('http://' или 'https://')",
nodefined : " е недефинирана!",
novalue : " изисква връщане на стойност!",
customarray : "Потреб. Функция трябва да върне масив!",
customfcheck : "Потребителска функция е задължителна при този тип елемент!"
}
},
view : {
caption: "Преглед запис",
bClose: "Затвори"
},
del : {
caption: "Изтриване",
msg: "Да изтрия ли избраният запис?",
bSubmit: "Изтрий",
bCancel: "Отказ"
},
nav : {
edittext: " ",
edittitle: "Редакция избран запис",
addtext:" ",
addtitle: "Добавяне нов запис",
deltext: " ",
deltitle: "Изтриване избран запис",
searchtext: " ",
searchtitle: "Търсене запис(и)",
refreshtext: "",
refreshtitle: "Обнови таблица",
alertcap: "Предупреждение",
alerttext: "Моля, изберете запис",
viewtext: "",
viewtitle: "Преглед избран запис"
},
col : {
caption: "Избери колони",
bSubmit: "Ок",
bCancel: "Изход"
},
errors : {
errcap : "Грешка",
nourl : "Няма посочен url адрес",
norecords: "Няма запис за обработка",
model : "Модела не съответства на имената!"
},
formatter : {
integer : {thousandsSeparator: " ", defaultValue: '0'},
number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'},
currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:" лв.", defaultValue: '0.00'},
date : {
dayNames: [
"Нед", "Пон", "Вт", "Ср", "Чет", "Пет", "Съб",
"Неделя", "Понеделник", "Вторник", "Сряда", "Четвъртък", "Петък", "Събота"
],
monthNames: [
"Яну", "Фев", "Мар", "Апр", "Май", "Юни", "Юли", "Авг", "Сеп", "Окт", "Нов", "Дек",
"Януари", "Февруари", "Март", "Април", "Май", "Юни", "Юли", "Август", "Септември", "Октомври", "Ноември", "Декември"
],
AmPm : ["","","",""],
S: function (j) {
if(j==7 || j==8 || j== 27 || j== 28) {
return 'ми';
}
return ['ви', 'ри', 'ти'][Math.min((j - 1) % 10, 2)];
},
srcformat: 'Y-m-d',
newformat: 'd/m/Y',
masks : {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
ShortDate: "n/j/Y",
LongDate: "l, F d, Y",
FullDateTime: "l, F d, Y g:i:s A",
MonthDay: "F d",
ShortTime: "g:i A",
LongTime: "g:i:s A",
SortableDateTime: "Y-m-d\\TH:i:s",
UniversalSortableDateTime: "Y-m-d H:i:sO",
YearMonth: "F, Y"
},
reformatAfterEdit : false
},
baseLinkUrl: '',
showAction: '',
target: '',
checkbox : {disabled:true},
idName : 'id'
}
};
})(jQuery);
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/3.8.2/js/i18n/grid.locale-bg.js | JavaScript | art | 5,099 |
;(function($){
/**
* jqGrid Japanese Translation
* OKADA Yoshitada okada.dev@sth.jp
* http://trirand.com/blog/
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
**/
$.jgrid = {
defaults : {
recordtext: "{2} \u4EF6\u4E2D {0} - {1} \u3092\u8868\u793A ",
emptyrecords: "\u8868\u793A\u3059\u308B\u30EC\u30B3\u30FC\u30C9\u304C\u3042\u308A\u307E\u305B\u3093",
loadtext: "\u8aad\u307f\u8fbc\u307f\u4e2d...",
pgtext : "{1} \u30DA\u30FC\u30B8\u4E2D {0} \u30DA\u30FC\u30B8\u76EE "
},
search : {
caption: "\u691c\u7d22...",
Find: "\u691c\u7d22",
Reset: "\u30ea\u30bb\u30c3\u30c8",
odata: ["\u6B21\u306B\u7B49\u3057\u3044", "\u6B21\u306B\u7B49\u3057\u304F\u306A\u3044",
"\u6B21\u3088\u308A\u5C0F\u3055\u3044", "\u6B21\u306B\u7B49\u3057\u3044\u304B\u5C0F\u3055\u3044",
"\u6B21\u3088\u308A\u5927\u304D\u3044", "\u6B21\u306B\u7B49\u3057\u3044\u304B\u5927\u304D\u3044",
"\u6B21\u3067\u59CB\u307E\u308B", "\u6B21\u3067\u59CB\u307E\u3089\u306A\u3044",
"\u6B21\u306B\u542B\u307E\u308C\u308B", "\u6B21\u306B\u542B\u307E\u308C\u306A\u3044",
"\u6B21\u3067\u7D42\u308F\u308B", "\u6B21\u3067\u7D42\u308F\u3089\u306A\u3044",
"\u6B21\u3092\u542B\u3080", "\u6B21\u3092\u542B\u307E\u306A\u3044"],
groupOps: [{
op: "AND",
text: "\u3059\u3079\u3066\u306E"
},
{
op: "OR",
text: "\u3044\u305A\u308C\u304B\u306E"
}],
matchText: " \u6B21\u306E",
rulesText: " \u6761\u4EF6\u3092\u6E80\u305F\u3059"
},
edit : {
addCaption: "\u30ec\u30b3\u30fc\u30c9\u8ffd\u52a0",
editCaption: "\u30ec\u30b3\u30fc\u30c9\u7de8\u96c6",
bSubmit: "\u9001\u4fe1",
bCancel: "\u30ad\u30e3\u30f3\u30bb\u30eb",
bClose: "\u9589\u3058\u308b",
saveData: "\u30C7\u30FC\u30BF\u304C\u5909\u66F4\u3055\u308C\u3066\u3044\u307E\u3059\u3002\u4FDD\u5B58\u3057\u307E\u3059\u304B\uFF1F",
bYes: "\u306F\u3044",
bNo: "\u3044\u3044\u3048",
bExit: "\u30AD\u30E3\u30F3\u30BB\u30EB",
msg: {
required:"\u3053\u306e\u9805\u76ee\u306f\u5fc5\u9808\u3067\u3059\u3002",
number:"\u6b63\u3057\u3044\u6570\u5024\u3092\u5165\u529b\u3057\u3066\u4e0b\u3055\u3044\u3002",
minValue:"\u6b21\u306e\u5024\u4ee5\u4e0a\u3067\u5165\u529b\u3057\u3066\u4e0b\u3055\u3044\u3002",
maxValue:"\u6b21\u306e\u5024\u4ee5\u4e0b\u3067\u5165\u529b\u3057\u3066\u4e0b\u3055\u3044\u3002",
email: "e-mail\u304c\u6b63\u3057\u304f\u3042\u308a\u307e\u305b\u3093\u3002",
integer: "\u6b63\u3057\u3044\u6574\u6570\u5024\u3092\u5165\u529b\u3057\u3066\u4e0b\u3055\u3044\u3002",
date: "\u6b63\u3057\u3044\u5024\u3092\u5165\u529b\u3057\u3066\u4e0b\u3055\u3044\u3002",
url: "\u306F\u6709\u52B9\u306AURL\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\20\u30D7\u30EC\u30D5\u30A3\u30C3\u30AF\u30B9\u304C\u5FC5\u8981\u3067\u3059\u3002 ('http://' \u307E\u305F\u306F 'https://')",
nodefined: " \u304C\u5B9A\u7FA9\u3055\u308C\u3066\u3044\u307E\u305B\u3093",
novalue: " \u623B\u308A\u5024\u304C\u5FC5\u8981\u3067\u3059",
customarray: "\u30AB\u30B9\u30BF\u30E0\u95A2\u6570\u306F\u914D\u5217\u3092\u8FD4\u3059\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059",
customfcheck: "\u30AB\u30B9\u30BF\u30E0\u691C\u8A3C\u306B\u306F\u30AB\u30B9\u30BF\u30E0\u95A2\u6570\u304C\u5FC5\u8981\u3067\u3059"
}
},
view : {
caption: "\u30EC\u30B3\u30FC\u30C9\u3092\u8868\u793A",
bClose: "\u9589\u3058\u308B"
},
del : {
caption: "\u524a\u9664",
msg: "\u9078\u629e\u3057\u305f\u30ec\u30b3\u30fc\u30c9\u3092\u524a\u9664\u3057\u307e\u3059\u304b\uff1f",
bSubmit: "\u524a\u9664",
bCancel: "\u30ad\u30e3\u30f3\u30bb\u30eb"
},
nav : {
edittext: " ",
edittitle: "\u9078\u629e\u3057\u305f\u884c\u3092\u7de8\u96c6",
addtext:" ",
addtitle: "\u884c\u3092\u65b0\u898f\u8ffd\u52a0",
deltext: " ",
deltitle: "\u9078\u629e\u3057\u305f\u884c\u3092\u524a\u9664",
searchtext: " ",
searchtitle: "\u30ec\u30b3\u30fc\u30c9\u691c\u7d22",
refreshtext: "",
refreshtitle: "\u30b0\u30ea\u30c3\u30c9\u3092\u30ea\u30ed\u30fc\u30c9",
alertcap: "\u8b66\u544a",
alerttext: "\u884c\u3092\u9078\u629e\u3057\u3066\u4e0b\u3055\u3044\u3002",
viewtext: "",
viewtitle: "\u9078\u629E\u3057\u305F\u884C\u3092\u8868\u793A"
},
col : {
caption: "\u5217\u3092\u8868\u793a\uff0f\u96a0\u3059",
bSubmit: "\u9001\u4fe1",
bCancel: "\u30ad\u30e3\u30f3\u30bb\u30eb"
},
errors : {
errcap : "\u30a8\u30e9\u30fc",
nourl : "URL\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002",
norecords: "\u51e6\u7406\u5bfe\u8c61\u306e\u30ec\u30b3\u30fc\u30c9\u304c\u3042\u308a\u307e\u305b\u3093\u3002",
model : "colNames\u306e\u9577\u3055\u304ccolModel\u3068\u4e00\u81f4\u3057\u307e\u305b\u3093\u3002"
},
formatter : {
integer: {
thousandsSeparator: ",",
defaultValue: '0'
},
number: {
decimalSeparator: ".",
thousandsSeparator: ",",
decimalPlaces: 2,
defaultValue: '0.00'
},
currency: {
decimalSeparator: ".",
thousandsSeparator: ",",
decimalPlaces: 0,
prefix: "",
suffix: "",
defaultValue: '0'
},
date : {
dayNames: [
"\u65e5", "\u6708", "\u706b", "\u6c34", "\u6728", "\u91d1", "\u571f",
"\u65e5", "\u6708", "\u706b", "\u6c34", "\u6728", "\u91d1", "\u571f"
],
monthNames: [
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12",
"1\u6708", "2\u6708", "3\u6708", "4\u6708", "5\u6708", "6\u6708", "7\u6708", "8\u6708", "9\u6708", "10\u6708", "11\u6708", "12\u6708"
],
AmPm : ["am","pm","AM","PM"],
S: "\u756a\u76ee",
srcformat: 'Y-m-d',
newformat: 'd/m/Y',
masks : {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
ShortDate: "n/j/Y",
LongDate: "l, F d, Y",
FullDateTime: "l, F d, Y g:i:s A",
MonthDay: "F d",
ShortTime: "g:i A",
LongTime: "g:i:s A",
SortableDateTime: "Y-m-d\\TH:i:s",
UniversalSortableDateTime: "Y-m-d H:i:sO",
YearMonth: "F, Y"
},
reformatAfterEdit : false
},
baseLinkUrl: '',
showAction: '',
target: '',
checkbox : {disabled:true},
idName : 'id'
}
};
})(jQuery);
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/3.8.2/js/i18n/grid.locale-ja.js | JavaScript | art | 6,853 |
;(function($){
/**
* jqGrid (fi) Finnish Translation
* Jukka Inkeri awot.fi 2010-05-19 Version
* http://awot.fi
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
**/
$.jgrid = {
defaults : {
//recordtext: "Näytä {0} - {1} / {2}",
recordtext: " {0}-{1}/{2}",
emptyrecords: "Ei näytettäviä",
loadtext: "Haetaan...",
//pgtext : "Sivu {0} / {1}"
pgtext : "{0}/{1}"
},
search : {
caption: "Etsi...",
Find: "Etsi",
Reset: "Tyhjää",
odata : ['=', '<>', '<', '<=','>','>=', 'alkaa','ei ala','joukossa','ei joukossa ','loppuu','ei lopu','sisältää','ei sisällä'],
groupOps: [ { op: "JA", text: "kaikki" }, { op: "TAI", text: "mikä tahansa" } ],
matchText: " match",
rulesText: " rules"
},
edit : {
addCaption: "Uusi rivi",
editCaption: "Muokkaa rivi",
bSubmit: "OK",
bCancel: "Peru",
bClose: "Sulje",
saveData: "Tietoja muutettu! Tallenetaanko?",
bYes : "K",
bNo : "E",
bExit : "Peru",
msg: {
required:"pakollinen",
number:"Anna kelvollinen nro",
minValue:"arvo oltava >= ",
maxValue:"arvo oltava <= ",
email: "virheellinen sposti ",
integer: "Anna kelvollinen kokonaisluku",
date: "Anna kelvollinen pvm",
url: "Ei ole sopiva linkki(URL). Alku oltava ('http://' tai 'https://')",
nodefined : " ei ole määritelty!",
novalue : " paluuarvo vaaditaan!",
customarray : "Custom function should return array!",
customfcheck : "Custom function should be present in case of custom checking!"
}
},
view : {
caption: "Nä rivi",
bClose: "Sulje"
},
del : {
caption: "Poista",
msg: "Poista valitut rivi(t)?",
bSubmit: "Poista",
bCancel: "Peru"
},
nav : {
edittext: " ",
edittitle: "Muokkaa valittu rivi",
addtext:" ",
addtitle: "Uusi rivi",
deltext: " ",
deltitle: "Poista valittu rivi",
searchtext: " ",
searchtitle: "Etsi tietoja",
refreshtext: "",
refreshtitle: "Lataa uudelleen",
alertcap: "Varoitus",
alerttext: "Valitse rivi",
viewtext: "",
viewtitle: "Nayta valitut rivit"
},
col : {
caption: "Nayta/Piilota sarakkeet",
bSubmit: "OK",
bCancel: "Peru"
},
errors : {
errcap : "Virhe",
nourl : "url asettamatta",
norecords: "Ei muokattavia tietoja",
model : "Pituus colNames <> colModel!"
},
formatter : {
integer : {thousandsSeparator: "", defaultValue: '0'},
number : {decimalSeparator:",", thousandsSeparator: "", decimalPlaces: 2, defaultValue: '0,00'},
currency : {decimalSeparator:",", thousandsSeparator: "", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'},
date : {
dayNames: [
"Su", "Ma", "Ti", "Ke", "To", "Pe", "La",
"Sunnuntai", "Maanantai", "Tiista", "Keskiviikko", "Torstai", "Perjantai", "Lauantai"
],
monthNames: [
"Tam", "Hel", "Maa", "Huh", "Tou", "Kes", "Hei", "Elo", "Syy", "Lok", "Mar", "Jou",
"Tammikuu", "Helmikuu", "Maaliskuu", "Huhtikuu", "Toukokuu", "Kesäkuu", "Heinäkuu", "Elokuu", "Syyskuu", "Lokakuu", "Marraskuu", "Joulukuu"
],
AmPm : ["am","pm","AM","PM"],
S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
srcformat: 'Y-m-d',
newformat: 'd/m/Y',
masks : {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
ShortDate: "d.m.Y",
LongDate: "l, F d, Y",
FullDateTime: "l, F d, Y g:i:s A",
MonthDay: "F d",
ShortTime: "g:i A",
LongTime: "g:i:s A",
SortableDateTime: "Y-m-d\\TH:i:s",
UniversalSortableDateTime: "Y-m-d H:i:sO",
YearMonth: "F, Y"
},
reformatAfterEdit : false
},
baseLinkUrl: '',
showAction: '',
target: '',
checkbox : {disabled:true},
idName : 'id'
}
};
// FI
})(jQuery);
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/3.8.2/js/i18n/grid.locale-fi.js | JavaScript | art | 4,204 |
;(function($){
/**
* jqGrid Galician Translation
* Translated by Jorge Barreiro <yortx.barry@gmail.com>
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
**/
$.jgrid = {
defaults : {
recordtext: "Amosando {0} - {1} de {2}",
emptyrecords: "Sen rexistros que amosar",
loadtext: "Cargando...",
pgtext : "Páxina {0} de {1}"
},
search : {
caption: "Búsqueda...",
Find: "Buscar",
Reset: "Limpar",
odata : ['igual ', 'diferente a', 'menor que', 'menor ou igual que','maior que','maior ou igual a', 'empece por','non empece por','está en','non está en','termina por','non termina por','contén','non contén'],
groupOps: [ { op: "AND", text: "todo" }, { op: "OR", text: "calquera" } ],
matchText: " match",
rulesText: " regras"
},
edit : {
addCaption: "Engadir rexistro",
editCaption: "Modificar rexistro",
bSubmit: "Gardar",
bCancel: "Cancelar",
bClose: "Pechar",
saveData: "Modificáronse os datos, quere gardar os cambios?",
bYes : "Si",
bNo : "Non",
bExit : "Cancelar",
msg: {
required:"Campo obrigatorio",
number:"Introduza un número",
minValue:"O valor debe ser maior ou igual a ",
maxValue:"O valor debe ser menor ou igual a ",
email: "non é un enderezo de correo válido",
integer: "Introduza un valor enteiro",
date: "Introduza unha data correcta ",
url: "non é unha URL válida. Prefixo requerido ('http://' ou 'https://')",
nodefined : " non está definido.",
novalue : " o valor de retorno é obrigatorio.",
customarray : "A función persoalizada debe devolver un array.",
customfcheck : "A función persoalizada debe estar presente no caso de ter validación persoalizada."
}
},
view : {
caption: "Consultar rexistro",
bClose: "Pechar"
},
del : {
caption: "Eliminar",
msg: "Desexa eliminar os rexistros seleccionados?",
bSubmit: "Eliminar",
bCancel: "Cancelar"
},
nav : {
edittext: " ",
edittitle: "Modificar a fila seleccionada",
addtext:" ",
addtitle: "Engadir unha nova fila",
deltext: " ",
deltitle: "Eliminar a fila seleccionada",
searchtext: " ",
searchtitle: "Buscar información",
refreshtext: "",
refreshtitle: "Recargar datos",
alertcap: "Aviso",
alerttext: "Seleccione unha fila",
viewtext: "",
viewtitle: "Ver fila seleccionada"
},
col : {
caption: "Mostrar/ocultar columnas",
bSubmit: "Enviar",
bCancel: "Cancelar"
},
errors : {
errcap : "Erro",
nourl : "Non especificou unha URL",
norecords: "Non hai datos para procesar",
model : "As columnas de nomes son diferentes das columnas de modelo"
},
formatter : {
integer : {thousandsSeparator: ".", defaultValue: '0'},
number : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, defaultValue: '0,00'},
currency : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'},
date : {
dayNames: [
"Do", "Lu", "Ma", "Me", "Xo", "Ve", "Sa",
"Domingo", "Luns", "Martes", "Mércoles", "Xoves", "Vernes", "Sábado"
],
monthNames: [
"Xan", "Feb", "Mar", "Abr", "Mai", "Xuñ", "Xul", "Ago", "Set", "Out", "Nov", "Dec",
"Xaneiro", "Febreiro", "Marzo", "Abril", "Maio", "Xuño", "Xullo", "Agosto", "Setembro", "Outubro", "Novembro", "Decembro"
],
AmPm : ["am","pm","AM","PM"],
S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
srcformat: 'Y-m-d',
newformat: 'd-m-Y',
masks : {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
ShortDate: "n/j/Y",
LongDate: "l, F d, Y",
FullDateTime: "l, F d, Y g:i:s A",
MonthDay: "F d",
ShortTime: "g:i A",
LongTime: "g:i:s A",
SortableDateTime: "Y-m-d\\TH:i:s",
UniversalSortableDateTime: "Y-m-d H:i:sO",
YearMonth: "F, Y"
},
reformatAfterEdit : false
},
baseLinkUrl: '',
showAction: '',
target: '',
checkbox : {disabled:true},
idName : 'id'
}
};
})(jQuery);
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/3.8.2/js/i18n/grid.locale-gl.js | JavaScript | art | 4,411 |
;(function($){
/**
* jqGrid Serbian Translation
* Александар Миловац(Aleksandar Milovac) aleksandar.milovac@gmail.com
* http://trirand.com/blog/
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
**/
$.jgrid = {
defaults : {
recordtext: "Преглед {0} - {1} од {2}",
emptyrecords: "Не постоји ниједан запис",
loadtext: "Учитавање...",
pgtext : "Страна {0} од {1}"
},
search : {
caption: "Тражење...",
Find: "Тражи",
Reset: "Ресетуј",
odata : ['једнако', 'није једнако', 'мање', 'мање или једнако','веће','веће или једнако', 'почиње са','не почиње са','је у','није у','завршава са','не завршава са','садржи','не садржи'],
groupOps: [ { op: "И", text: "сви" }, { op: "ИЛИ", text: "сваки" } ],
matchText: " match",
rulesText: " правила"
},
edit : {
addCaption: "Додај запис",
editCaption: "Измени запис",
bSubmit: "Пошаљи",
bCancel: "Одустани",
bClose: "Затвори",
saveData: "Податак је измењен! Сачувај измене?",
bYes : "Да",
bNo : "Не",
bExit : "Одустани",
msg: {
required:"Поље је обавезно",
number:"Молим, унесите исправан број",
minValue:"вредност мора бити већа од или једнака са ",
maxValue:"вредност мора бити мања од или једнака са",
email: "није исправна имејл адреса",
integer: "Молим, унесите исправну целобројну вредност ",
date: "Молим, унесите исправан датум",
url: "није исправан УРЛ. Потребан је префикс ('http://' or 'https://')",
nodefined : " није дефинисан!",
novalue : " захтевана је повратна вредност!",
customarray : "Custom function should return array!",
customfcheck : "Custom function should be present in case of custom checking!"
}
},
view : {
caption: "Погледај запис",
bClose: "Затвори"
},
del : {
caption: "Избриши",
msg: "Избриши изабран(е) запис(е)?",
bSubmit: "Ибриши",
bCancel: "Одбаци"
},
nav : {
edittext: "",
edittitle: "Измени изабрани ред",
addtext:"",
addtitle: "Додај нови ред",
deltext: "",
deltitle: "Избриши изабран ред",
searchtext: "",
searchtitle: "Нађи записе",
refreshtext: "",
refreshtitle: "Поново учитај податке",
alertcap: "Упозорење",
alerttext: "Молим, изаберите ред",
viewtext: "",
viewtitle: "Погледај изабрани ред"
},
col : {
caption: "Изабери колоне",
bSubmit: "ОК",
bCancel: "Одбаци"
},
errors : {
errcap : "Грешка",
nourl : "Није постављен URL",
norecords: "Нема записа за обраду",
model : "Дужина модела colNames <> colModel!"
},
formatter : {
integer : {thousandsSeparator: " ", defaultValue: '0'},
number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'},
currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'},
date : {
dayNames: [
"Нед", "Пон", "Уто", "Сре", "Чет", "Пет", "Суб",
"Недеља", "Понедељак", "Уторак", "Среда", "Четвртак", "Петак", "Субота"
],
monthNames: [
"Јан", "Феб", "Мар", "Апр", "Мај", "Јун", "Јул", "Авг", "Сеп", "Окт", "Нов", "Дец",
"Јануар", "Фебруар", "Март", "Април", "Мај", "Јун", "Јул", "Август", "Септембар", "Октобар", "Новембар", "Децембар"
],
AmPm : ["am","pm","AM","PM"],
S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
srcformat: 'Y-m-d',
newformat: 'd/m/Y',
masks : {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
ShortDate: "n/j/Y",
LongDate: "l, F d, Y",
FullDateTime: "l, F d, Y g:i:s A",
MonthDay: "F d",
ShortTime: "g:i A",
LongTime: "g:i:s A",
SortableDateTime: "Y-m-d\\TH:i:s",
UniversalSortableDateTime: "Y-m-d H:i:sO",
YearMonth: "F, Y"
},
reformatAfterEdit : false
},
baseLinkUrl: '',
showAction: '',
target: '',
checkbox : {disabled:true},
idName : 'id'
}
};
})(jQuery);
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/3.8.2/js/i18n/grid.locale-sr.js | JavaScript | art | 5,027 |
;(function($){
/**
* jqGrid French Translation
* Tony Tomov tony@trirand.com
* http://trirand.com/blog/
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
**/
$.jgrid = {
defaults : {
recordtext: "Enregistrements {0} - {1} sur {2}",
emptyrecords: "Aucun enregistrement à afficher",
loadtext: "Chargement...",
pgtext : "Page {0} sur {1}"
},
search : {
caption: "Recherche...",
Find: "Chercher",
Reset: "Annuler",
odata : ['égal', 'différent', 'inférieur', 'inférieur ou égal','supérieur','supérieur ou égal', 'commence par','ne commence pas par','est dans',"n'est pas dans",'finit par','ne finit pas par','contient','ne contient pas'],
groupOps: [ { op: "AND", text: "tous" }, { op: "OR", text: "aucun" } ],
matchText: " correspondance",
rulesText: " règles"
},
edit : {
addCaption: "Ajouter",
editCaption: "Editer",
bSubmit: "Valider",
bCancel: "Annuler",
bClose: "Fermer",
saveData: "Les données ont changé ! Enregistrer les modifications ?",
bYes: "Oui",
bNo: "Non",
bExit: "Annuler",
msg: {
required: "Champ obligatoire",
number: "Saisissez un nombre correct",
minValue: "La valeur doit être supérieure ou égale à",
maxValue: "La valeur doit être inférieure ou égale à",
email: "n'est pas un email correct",
integer: "Saisissez un entier correct",
url: "n'est pas une adresse correcte. Préfixe requis ('http://' or 'https://')",
nodefined : " n'est pas défini!",
novalue : " la valeur de retour est requise!",
customarray : "Une fonction personnalisée devrait retourner un tableau (array)!",
customfcheck : "Une fonction personnalisée devrait être présente dans le cas d'une vérification personnalisée!"
}
},
view : {
caption: "Voir les enregistrement",
bClose: "Fermer"
},
del : {
caption: "Supprimer",
msg: "Supprimer les enregistrements sélectionnés ?",
bSubmit: "Supprimer",
bCancel: "Annuler"
},
nav : {
edittext: " ",
edittitle: "Editer la ligne sélectionnée",
addtext:" ",
addtitle: "Ajouter une ligne",
deltext: " ",
deltitle: "Supprimer la ligne sélectionnée",
searchtext: " ",
searchtitle: "Chercher un enregistrement",
refreshtext: "",
refreshtitle: "Recharger le tableau",
alertcap: "Avertissement",
alerttext: "Veuillez sélectionner une ligne",
viewtext: "",
viewtitle: "Afficher la ligne sélectionnée"
},
col : {
caption: "Afficher/Masquer les colonnes",
bSubmit: "Valider",
bCancel: "Annuler"
},
errors : {
errcap : "Erreur",
nourl : "Aucune adresse n'est paramétrée",
norecords: "Aucun enregistrement à traiter",
model : "Nombre de titres (colNames) <> Nombre de données (colModel)!"
},
formatter : {
integer : {thousandsSeparator: " ", defaultValue: '0'},
number : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0,00'},
currency : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'},
date : {
dayNames: [
"Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam",
"Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi"
],
monthNames: [
"Jan", "Fév", "Mar", "Avr", "Mai", "Jui", "Jul", "Aou", "Sep", "Oct", "Nov", "Déc",
"Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Aout", "Septembre", "Octobre", "Novembre", "Décembre"
],
AmPm : ["am","pm","AM","PM"],
S: function (j) {return j == 1 ? 'er' : 'e';},
srcformat: 'Y-m-d',
newformat: 'd/m/Y',
masks : {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
ShortDate: "n/j/Y",
LongDate: "l, F d, Y",
FullDateTime: "l, F d, Y g:i:s A",
MonthDay: "F d",
ShortTime: "g:i A",
LongTime: "g:i:s A",
SortableDateTime: "Y-m-d\\TH:i:s",
UniversalSortableDateTime: "Y-m-d H:i:sO",
YearMonth: "F, Y"
},
reformatAfterEdit : false
},
baseLinkUrl: '',
showAction: '',
target: '',
checkbox : {disabled:true},
idName : 'id'
}
};
})(jQuery);
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/3.8.2/js/i18n/grid.locale-fr.js | JavaScript | art | 4,239 |
;(function($){
/**
* jqGrid Czech Translation
* Pavel Jirak pavel.jirak@jipas.cz
* doplnil Thomas Wagner xwagne01@stud.fit.vutbr.cz
* http://trirand.com/blog/
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
**/
$.jgrid = {
defaults : {
recordtext: "Zobrazeno {0} - {1} z {2} záznamů",
emptyrecords: "Nenalezeny žádné záznamy",
loadtext: "Načítám...",
pgtext : "Strana {0} z {1}"
},
search : {
caption: "Vyhledávám...",
Find: "Hledat",
Reset: "Reset",
odata : ['rovno', 'nerovono', 'menší', 'menší nebo rovno','větší', 'větší nebo rovno', 'začíná s', 'nezačíná s', 'je v', 'není v', 'končí s', 'nekončí s', 'obahuje', 'neobsahuje'],
groupOps: [ { op: "AND", text: "všech" }, { op: "OR", text: "některého z" } ],
matchText: " hledat podle",
rulesText: " pravidel"
},
edit : {
addCaption: "Přidat záznam",
editCaption: "Editace záznamu",
bSubmit: "Uložit",
bCancel: "Storno",
bClose: "Zavřít",
saveData: "Data byla změněna! Uložit změny?",
bYes : "Ano",
bNo : "Ne",
bExit : "Zrušit",
msg: {
required:"Pole je vyžadováno",
number:"Prosím, vložte validní číslo",
minValue:"hodnota musí být větší než nebo rovná ",
maxValue:"hodnota musí být menší než nebo rovná ",
email: "není validní e-mail",
integer: "Prosím, vložte celé číslo",
date: "Prosím, vložte validní datum",
url: "není platnou URL. Vyžadován prefix ('http://' or 'https://')",
nodefined : " není definován!",
novalue : " je vyžadována návratová hodnota!",
customarray : "Custom function mělá vrátit pole!",
customfcheck : "Custom function by měla být přítomna v případě custom checking!"
}
},
view : {
caption: "Zobrazit záznam",
bClose: "Zavřít"
},
del : {
caption: "Smazat",
msg: "Smazat vybraný(é) záznam(y)?",
bSubmit: "Smazat",
bCancel: "Storno"
},
nav : {
edittext: " ",
edittitle: "Editovat vybraný řádek",
addtext:" ",
addtitle: "Přidat nový řádek",
deltext: " ",
deltitle: "Smazat vybraný záznam ",
searchtext: " ",
searchtitle: "Najít záznamy",
refreshtext: "",
refreshtitle: "Obnovit tabulku",
alertcap: "Varování",
alerttext: "Prosím, vyberte řádek",
viewtext: "",
viewtitle: "Zobrazit vybraný řádek"
},
col : {
caption: "Zobrazit/Skrýt sloupce",
bSubmit: "Uložit",
bCancel: "Storno"
},
errors : {
errcap : "Chyba",
nourl : "Není nastavena url",
norecords: "Žádné záznamy ke zpracování",
model : "Délka colNames <> colModel!"
},
formatter : {
integer : {thousandsSeparator: " ", defaultValue: '0'},
number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'},
currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'},
date : {
dayNames: [
"Ne", "Po", "Út", "St", "Čt", "Pá", "So",
"Neděle", "Pondělí", "Úterý", "Středa", "Čtvrtek", "Pátek", "Sobota"
],
monthNames: [
"Led", "Úno", "Bře", "Dub", "Kvě", "Čer", "Čvc", "Srp", "Zář", "Říj", "Lis", "Pro",
"Leden", "Únor", "Březen", "Duben", "Květen", "Červen", "Červenec", "Srpen", "Září", "Říjen", "Listopad", "Prosinec"
],
AmPm : ["do","od","DO","OD"],
S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
srcformat: 'Y-m-d',
newformat: 'd/m/Y',
masks : {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
ShortDate: "n/j/Y",
LongDate: "l, F d, Y",
FullDateTime: "l, F d, Y g:i:s A",
MonthDay: "F d",
ShortTime: "g:i A",
LongTime: "g:i:s A",
SortableDateTime: "Y-m-d\\TH:i:s",
UniversalSortableDateTime: "Y-m-d H:i:sO",
YearMonth: "F, Y"
},
reformatAfterEdit : false
},
baseLinkUrl: '',
showAction: '',
target: '',
checkbox : {disabled:true},
idName : 'id'
}
};
})(jQuery);
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/3.8.2/js/i18n/grid.locale-cs.js | JavaScript | art | 4,312 |
;(function($){
/**
* jqGrid English Translation
* Tony Tomov tony@trirand.com
* http://trirand.com/blog/
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
**/
$.jgrid = {
defaults : {
recordtext: "View {0} - {1} of {2}",
emptyrecords: "No records to view",
loadtext: "Loading...",
pgtext : "Page {0} of {1}"
},
search : {
caption: "Search...",
Find: "Find",
Reset: "Reset",
odata : ['equal', 'not equal', 'less', 'less or equal','greater','greater or equal', 'begins with','does not begin with','is in','is not in','ends with','does not end with','contains','does not contain'],
groupOps: [ { op: "AND", text: "all" }, { op: "OR", text: "any" } ],
matchText: " match",
rulesText: " rules"
},
edit : {
addCaption: "Add Record",
editCaption: "Edit Record",
bSubmit: "Submit",
bCancel: "Cancel",
bClose: "Close",
saveData: "Data has been changed! Save changes?",
bYes : "Yes",
bNo : "No",
bExit : "Cancel",
msg: {
required:"Field is required",
number:"Please, enter valid number",
minValue:"value must be greater than or equal to ",
maxValue:"value must be less than or equal to",
email: "is not a valid e-mail",
integer: "Please, enter valid integer value",
date: "Please, enter valid date value",
url: "is not a valid URL. Prefix required ('http://' or 'https://')",
nodefined : " is not defined!",
novalue : " return value is required!",
customarray : "Custom function should return array!",
customfcheck : "Custom function should be present in case of custom checking!"
}
},
view : {
caption: "View Record",
bClose: "Close"
},
del : {
caption: "Delete",
msg: "Delete selected record(s)?",
bSubmit: "Delete",
bCancel: "Cancel"
},
nav : {
edittext: "",
edittitle: "Edit selected row",
addtext:"",
addtitle: "Add new row",
deltext: "",
deltitle: "Delete selected row",
searchtext: "",
searchtitle: "Find records",
refreshtext: "",
refreshtitle: "Reload Grid",
alertcap: "Warning",
alerttext: "Please, select row",
viewtext: "",
viewtitle: "View selected row"
},
col : {
caption: "Select columns",
bSubmit: "Ok",
bCancel: "Cancel"
},
errors : {
errcap : "Error",
nourl : "No url is set",
norecords: "No records to process",
model : "Length of colNames <> colModel!"
},
formatter : {
integer : {thousandsSeparator: " ", defaultValue: '0'},
number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'},
currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'},
date : {
dayNames: [
"Sun", "Mon", "Tue", "Wed", "Thr", "Fri", "Sat",
"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
],
monthNames: [
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
],
AmPm : ["am","pm","AM","PM"],
S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
srcformat: 'Y-m-d',
newformat: 'd/m/Y',
masks : {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
ShortDate: "n/j/Y",
LongDate: "l, F d, Y",
FullDateTime: "l, F d, Y g:i:s A",
MonthDay: "F d",
ShortTime: "g:i A",
LongTime: "g:i:s A",
SortableDateTime: "Y-m-d\\TH:i:s",
UniversalSortableDateTime: "Y-m-d H:i:sO",
YearMonth: "F, Y"
},
reformatAfterEdit : false
},
baseLinkUrl: '',
showAction: '',
target: '',
checkbox : {disabled:true},
idName : 'id'
}
};
})(jQuery);
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/3.8.2/js/i18n/grid.locale-en.js | JavaScript | art | 3,927 |
;(function($){
/**
* jqGrid Hungarian Translation
* Őrszigety Ádám udx6bs@freemail.hu
* http://trirand.com/blog/
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
**/
$.jgrid = {
defaults : {
recordtext: "Oldal {0} - {1} / {2}",
emptyrecords: "Nincs találat",
loadtext: "Betöltés...",
pgtext : "Oldal {0} / {1}"
},
search : {
caption: "Keresés...",
Find: "Keres",
Reset: "Alapértelmezett",
odata : ['egyenlő', 'nem egyenlő', 'kevesebb', 'kevesebb vagy egyenlő','nagyobb','nagyobb vagy egyenlő', 'ezzel kezdődik','nem ezzel kezdődik','tartalmaz','nem tartalmaz','végződik','nem végződik','tartalmaz','nem tartalmaz'],
groupOps: [ { op: "AND", text: "all" }, { op: "OR", text: "any" } ],
matchText: " match",
rulesText: " rules"
},
edit : {
addCaption: "Új tétel",
editCaption: "Tétel szerkesztése",
bSubmit: "Mentés",
bCancel: "Mégse",
bClose: "Bezárás",
saveData: "A tétel megváltozott! Tétel mentése?",
bYes : "Igen",
bNo : "Nem",
bExit : "Mégse",
msg: {
required:"Kötelező mező",
number:"Kérjük, adjon meg egy helyes számot",
minValue:"Nagyobb vagy egyenlőnek kell lenni mint ",
maxValue:"Kisebb vagy egyenlőnek kell lennie mint",
email: "hibás emailcím",
integer: "Kérjük adjon meg egy helyes egész számot",
date: "Kérjük adjon meg egy helyes dátumot",
url: "nem helyes cím. Előtag kötelező ('http://' vagy 'https://')",
nodefined : " nem definiált!",
novalue : " visszatérési érték kötelező!!",
customarray : "Custom function should return array!",
customfcheck : "Custom function should be present in case of custom checking!"
}
},
view : {
caption: "Tétel megtekintése",
bClose: "Bezárás"
},
del : {
caption: "Törlés",
msg: "Kiválaztott tétel(ek) törlése?",
bSubmit: "Törlés",
bCancel: "Mégse"
},
nav : {
edittext: "",
edittitle: "Tétel szerkesztése",
addtext:"",
addtitle: "Új tétel hozzáadása",
deltext: "",
deltitle: "Tétel törlése",
searchtext: "",
searchtitle: "Keresés",
refreshtext: "",
refreshtitle: "Frissítés",
alertcap: "Figyelmeztetés",
alerttext: "Kérem válasszon tételt.",
viewtext: "",
viewtitle: "Tétel megtekintése"
},
col : {
caption: "Oszlopok kiválasztása",
bSubmit: "Ok",
bCancel: "Mégse"
},
errors : {
errcap : "Hiba",
nourl : "Nincs URL beállítva",
norecords: "Nincs feldolgozásra váró tétel",
model : "colNames és colModel hossza nem egyenlő!"
},
formatter : {
integer : {thousandsSeparator: " ", defaultValue: '0'},
number : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0,00'},
currency : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'},
date : {
dayNames: [
"Va", "Hé", "Ke", "Sze", "Csü", "Pé", "Szo",
"Vasárnap", "Hétfő", "Kedd", "Szerda", "Csütörtök", "Péntek", "Szombat"
],
monthNames: [
"Jan", "Feb", "Már", "Ápr", "Máj", "Jún", "Júl", "Aug", "Szep", "Okt", "Nov", "Dec",
"Január", "Február", "Március", "Áprili", "Május", "Június", "Július", "Augusztus", "Szeptember", "Október", "November", "December"
],
AmPm : ["de","du","DE","DU"],
S: function (j) {return '.-ik';},
srcformat: 'Y-m-d',
newformat: 'Y/m/d',
masks : {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
ShortDate: "Y/j/n",
LongDate: "Y. F hó d., l",
FullDateTime: "l, F d, Y g:i:s A",
MonthDay: "F d",
ShortTime: "a g:i",
LongTime: "a g:i:s",
SortableDateTime: "Y-m-d\\TH:i:s",
UniversalSortableDateTime: "Y-m-d H:i:sO",
YearMonth: "Y, F"
},
reformatAfterEdit : false
},
baseLinkUrl: '',
showAction: '',
target: '',
checkbox : {disabled:true},
idName : 'id'
}
};
})(jQuery);
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/3.8.2/js/i18n/grid.locale-hu.js | JavaScript | art | 4,102 |
;(function($){
/**
* jqGrid Slovak Translation
* Milan Cibulka
* http://trirand.com/blog/
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
**/
$.jgrid = {
defaults : {
recordtext: "Zobrazených {0} - {1} z {2} záznamov",
emptyrecords: "Neboli nájdené žiadne záznamy",
loadtext: "Načítám...",
pgtext : "Strana {0} z {1}"
},
search : {
caption: "Vyhľadávam...",
Find: "Hľadať",
Reset: "Reset",
odata : ['rovná sa', 'nerovná sa', 'menšie', 'menšie alebo rovnajúce sa','väčšie', 'väčšie alebo rovnajúce sa', 'začína s', 'nezačína s', 'je v', 'nie je v', 'končí s', 'nekončí s', 'obahuje', 'neobsahuje'],
groupOps: [ { op: "AND", text: "všetkých" }, { op: "OR", text: "niektorého z" } ],
matchText: " hľadať podla",
rulesText: " pravidiel"
},
edit : {
addCaption: "Pridať záznam",
editCaption: "Editácia záznamov",
bSubmit: "Uložiť",
bCancel: "Storno",
bClose: "Zavrieť",
saveData: "Údaje boli zmenené! Uložiť zmeny?",
bYes : "Ano",
bNo : "Nie",
bExit : "Zrušiť",
msg: {
required:"Pole je požadované",
number:"Prosím, vložte valídne číslo",
minValue:"hodnota musí býť väčšia ako alebo rovná ",
maxValue:"hodnota musí býť menšia ako alebo rovná ",
email: "nie je valídny e-mail",
integer: "Prosím, vložte celé číslo",
date: "Prosím, vložte valídny dátum",
url: "nie je platnou URL. Požadovaný prefix ('http://' alebo 'https://')",
nodefined : " nie je definovaný!",
novalue : " je vyžadovaná návratová hodnota!",
customarray : "Custom function mala vrátiť pole!",
customfcheck : "Custom function by mala byť prítomná v prípade custom checking!"
}
},
view : {
caption: "Zobraziť záznam",
bClose: "Zavrieť"
},
del : {
caption: "Zmazať",
msg: "Zmazať vybraný(é) záznam(y)?",
bSubmit: "Zmazať",
bCancel: "Storno"
},
nav : {
edittext: " ",
edittitle: "Editovať vybraný riadok",
addtext:" ",
addtitle: "Pridať nový riadek",
deltext: " ",
deltitle: "Zmazať vybraný záznam ",
searchtext: " ",
searchtitle: "Nájsť záznamy",
refreshtext: "",
refreshtitle: "Obnoviť tabuľku",
alertcap: "Varovanie",
alerttext: "Prosím, vyberte riadok",
viewtext: "",
viewtitle: "Zobraziť vybraný riadok"
},
col : {
caption: "Zobrazit/Skrýť stĺpce",
bSubmit: "Uložiť",
bCancel: "Storno"
},
errors : {
errcap : "Chyba",
nourl : "Nie je nastavená url",
norecords: "Žiadne záznamy k spracovaniu",
model : "Dĺžka colNames <> colModel!"
},
formatter : {
integer : {thousandsSeparator: " ", defaultValue: '0'},
number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'},
currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'},
date : {
dayNames: [
"Ne", "Po", "Ut", "St", "Št", "Pi", "So",
"Nedela", "Pondelok", "Utorok", "Streda", "Štvrtok", "Piatek", "Sobota"
],
monthNames: [
"Jan", "Feb", "Mar", "Apr", "Máj", "Jún", "Júl", "Aug", "Sep", "Okt", "Nov", "Dec",
"Január", "Február", "Marec", "Apríl", "Máj", "Jún", "Júl", "August", "September", "Október", "November", "December"
],
AmPm : ["do","od","DO","OD"],
S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
srcformat: 'Y-m-d',
newformat: 'd/m/Y',
masks : {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
ShortDate: "n/j/Y",
LongDate: "l, F d, Y",
FullDateTime: "l, F d, Y g:i:s A",
MonthDay: "F d",
ShortTime: "g:i A",
LongTime: "g:i:s A",
SortableDateTime: "Y-m-d\\TH:i:s",
UniversalSortableDateTime: "Y-m-d H:i:sO",
YearMonth: "F, Y"
},
reformatAfterEdit : false
},
baseLinkUrl: '',
showAction: '',
target: '',
checkbox : {disabled:true},
idName : 'id'
}
};
})(jQuery);
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/3.8.2/js/i18n/grid.locale-sk.js | JavaScript | art | 4,291 |
;(function ($) {
/*
* jqGrid 3.8.2 - jQuery Grid
* Copyright (c) 2008, Tony Tomov, tony@trirand.com
* Dual licensed under the MIT and GPL licenses
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl-2.0.html
* Date: 2010-12-14
*/
$.jgrid = $.jgrid || {};
$.extend($.jgrid,{
htmlDecode : function(value){
if(value==' ' || value==' ' || (value.length==1 && value.charCodeAt(0)==160)) { return "";}
return !value ? value : String(value).replace(/&/g, "&").replace(/>/g, ">").replace(/</g, "<").replace(/"/g, '"');
},
htmlEncode : function (value){
return !value ? value : String(value).replace(/&/g, "&").replace(/>/g, ">").replace(/</g, "<").replace(/\"/g, """);
},
format : function(format){ //jqgformat
var args = $.makeArray(arguments).slice(1);
if(format===undefined) { format = ""; }
return format.replace(/\{(\d+)\}/g, function(m, i){
return args[i];
});
},
getCellIndex : function (cell) {
var c = $(cell);
if (c.is('tr')) { return -1; }
c = (!c.is('td') && !c.is('th') ? c.closest("td,th") : c)[0];
if ($.browser.msie) { return $.inArray(c, c.parentNode.cells); }
return c.cellIndex;
},
stripHtml : function(v) {
v = v+"";
var regexp = /<("[^"]*"|'[^']*'|[^'">])*>/gi;
if (v) {
v = v.replace(regexp,"");
return (v && v !== ' ' && v !== ' ') ? v.replace(/\"/g,"'") : "";
} else {
return v;
}
},
stringToDoc : function (xmlString) {
var xmlDoc;
if(typeof xmlString !== 'string') { return xmlString; }
try {
var parser = new DOMParser();
xmlDoc = parser.parseFromString(xmlString,"text/xml");
}
catch(e) {
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async=false;
xmlDoc.loadXML(xmlString);
}
return (xmlDoc && xmlDoc.documentElement && xmlDoc.documentElement.tagName != 'parsererror') ? xmlDoc : null;
},
parse : function(jsonString) {
var js = jsonString;
if (js.substr(0,9) == "while(1);") { js = js.substr(9); }
if (js.substr(0,2) == "/*") { js = js.substr(2,js.length-4); }
if(!js) { js = "{}"; }
return ($.jgrid.useJSON===true && typeof (JSON) === 'object' && typeof (JSON.parse) === 'function') ?
JSON.parse(js) :
eval('(' + js + ')');
},
parseDate : function(format, date) {
var tsp = {m : 1, d : 1, y : 1970, h : 0, i : 0, s : 0},k,hl,dM;
if(date && date !== null && date !== undefined){
date = $.trim(date);
date = date.split(/[\\\/:_;.\t\T\s-]/);
format = format.split(/[\\\/:_;.\t\T\s-]/);
var dfmt = $.jgrid.formatter.date.monthNames;
var afmt = $.jgrid.formatter.date.AmPm;
var h12to24 = function(ampm, h){
if (ampm === 0){ if (h == 12) { h = 0;} }
else { if (h != 12) { h += 12; } }
return h;
};
for(k=0,hl=format.length;k<hl;k++){
if(format[k] == 'M') {
dM = $.inArray(date[k],dfmt);
if(dM !== -1 && dM < 12){date[k] = dM+1;}
}
if(format[k] == 'F') {
dM = $.inArray(date[k],dfmt);
if(dM !== -1 && dM > 11){date[k] = dM+1-12;}
}
if(format[k] == 'a') {
dM = $.inArray(date[k],afmt);
if(dM !== -1 && dM < 2 && date[k] == afmt[dM]){
date[k] = dM;
tsp.h = h12to24(date[k], tsp.h);
}
}
if(format[k] == 'A') {
dM = $.inArray(date[k],afmt);
if(dM !== -1 && dM > 1 && date[k] == afmt[dM]){
date[k] = dM-2;
tsp.h = h12to24(date[k], tsp.h);
}
}
if(date[k] !== undefined) {
tsp[format[k].toLowerCase()] = parseInt(date[k],10);
}
}
tsp.m = parseInt(tsp.m,10)-1;
var ty = tsp.y;
if (ty >= 70 && ty <= 99) {tsp.y = 1900+tsp.y;}
else if (ty >=0 && ty <=69) {tsp.y= 2000+tsp.y;}
}
return new Date(tsp.y, tsp.m, tsp.d, tsp.h, tsp.i, tsp.s,0);
},
jqID : function(sid){
sid = sid + "";
return sid.replace(/([\.\:\[\]])/g,"\\$1");
},
getAccessor : function(obj, expr) {
var ret,p,prm, i;
if( typeof expr === 'function') { return expr(obj); }
ret = obj[expr];
if(ret===undefined) {
try {
if ( typeof expr === 'string' ) {
prm = expr.split('.');
}
i = prm.length;
if( i ) {
ret = obj;
while (ret && i--) {
p = prm.shift();
ret = ret[p];
}
}
} catch (e) {}
}
return ret;
},
ajaxOptions: {},
from : function(source,initalQuery){
// Original Author Hugo Bonacci
// License MIT http://jlinq.codeplex.com/license
var queryObject=function(d,q){
if(typeof(d)=="string"){
d=$.data(d);
}
var self=this,
_data=d,
_usecase=true,
_trim=false,
_query=q,
_stripNum = /[\$,%]/g,
_lastCommand=null,
_lastField=null,
_negate=false,
_queuedOperator="",
_sorting=[],
_useProperties=true;
if(typeof(d)=="object"&&d.push) {
if(d.length>0){
if(typeof(d[0])!="object"){
_useProperties=false;
}else{
_useProperties=true;
}
}
}else{
throw "data provides is not an array";
}
this._hasData=function(){
return _data===null?false:_data.length===0?false:true;
};
this._getStr=function(s){
var phrase=[];
if(_trim){
phrase.push("jQuery.trim(");
}
phrase.push("String("+s+")");
if(_trim){
phrase.push(")");
}
if(!_usecase){
phrase.push(".toLowerCase()");
}
return phrase.join("");
};
this._strComp=function(val){
if(typeof(val)=="string"){
return".toString()";
}else{
return"";
}
};
this._group=function(f,u){
return({field:f.toString(),unique:u,items:[]});
};
this._toStr=function(phrase){
if(_trim){
phrase=$.trim(phrase);
}
if(!_usecase){
phrase=phrase.toLowerCase();
}
phrase=phrase.toString().replace(new RegExp('\\"',"g"),'\\"');
return phrase;
};
this._funcLoop=function(func){
var results=[];
$.each(_data,function(i,v){
results.push(func(v));
});
return results;
};
this._append=function(s){
if(_query===null){
_query="";
} else {
_query+=_queuedOperator === "" ? " && " :_queuedOperator;
}
if(_negate){
_query+="!";
}
_query+="("+s+")";
_negate=false;
_queuedOperator="";
};
this._setCommand=function(f,c){
_lastCommand=f;
_lastField=c;
};
this._resetNegate=function(){
_negate=false;
};
this._repeatCommand=function(f,v){
if(_lastCommand===null){
return self;
}
if(f!=null&&v!=null){
return _lastCommand(f,v);
}
if(_lastField===null){
return _lastCommand(f);
}
if(!_useProperties){
return _lastCommand(f);
}
return _lastCommand(_lastField,f);
};
this._equals=function(a,b){
return(self._compare(a,b,1)===0);
};
this._compare=function(a,b,d){
if( d === undefined) { d = 1; }
if(a===undefined) { a = null; }
if(b===undefined) { b = null; }
if(a===null && b===null){
return 0;
}
if(a===null&&b!==null){
return 1;
}
if(a!==null&&b===null){
return -1;
}
if(!_usecase && typeof(a) !== "number" && typeof(b) !== "number" ) {
a=String(a).toLowerCase();
b=String(b).toLowerCase();
}
if(a<b){return -d;}
if(a>b){return d;}
return 0;
};
this._performSort=function(){
if(_sorting.length===0){return;}
_data=self._doSort(_data,0);
};
this._doSort=function(d,q){
var by=_sorting[q].by,
dir=_sorting[q].dir,
type = _sorting[q].type,
dfmt = _sorting[q].datefmt;
if(q==_sorting.length-1){
return self._getOrder(d, by, dir, type, dfmt);
}
q++;
var values=self._getGroup(d,by,dir,type,dfmt);
var results=[];
for(var i=0;i<values.length;i++){
var sorted=self._doSort(values[i].items,q);
for(var j=0;j<sorted.length;j++){
results.push(sorted[j]);
}
}
return results;
};
this._getOrder=function(data,by,dir,type, dfmt){
var sortData=[],_sortData=[], newDir = dir=="a" ? 1 : -1, i,ab,j,
findSortKey;
if(type === undefined ) { type = "text"; }
if (type == 'float' || type== 'number' || type== 'currency' || type== 'numeric') {
findSortKey = function($cell, a) {
var key = parseFloat( String($cell).replace(_stripNum, ''));
return isNaN(key) ? 0.00 : key;
};
} else if (type=='int' || type=='integer') {
findSortKey = function($cell, a) {
return $cell ? parseFloat(String($cell).replace(_stripNum, '')) : 0;
};
} else if(type == 'date' || type == 'datetime') {
findSortKey = function($cell, a) {
return $.jgrid.parseDate(dfmt,$cell).getTime();
};
} else if($.isFunction(type)) {
findSortKey = type;
} else {
findSortKey = function($cell, a) {
if(!$cell) {$cell ="";}
return $.trim(String($cell).toUpperCase());
};
}
$.each(data,function(i,v){
ab = by!=="" ? $.jgrid.getAccessor(v,by) : v;
if(ab === undefined) { ab = ""; }
ab = findSortKey(ab, v);
_sortData.push({ 'vSort': ab,'index':i});
});
_sortData.sort(function(a,b){
a = a.vSort;
b = b.vSort;
return self._compare(a,b,newDir);
});
j=0;
var nrec= data.length;
// overhead, but we do not change the original data.
while(j<nrec) {
i = _sortData[j].index;
sortData.push(data[i]);
j++;
}
return sortData;
};
this._getGroup=function(data,by,dir,type, dfmt){
var results=[],
group=null,
last=null, val;
$.each(self._getOrder(data,by,dir,type, dfmt),function(i,v){
val = $.jgrid.getAccessor(v, by);
if(val === undefined) { val = ""; }
if(!self._equals(last,val)){
last=val;
if(group!=null){
results.push(group);
}
group=self._group(by,val);
}
group.items.push(v);
});
if(group!=null){
results.push(group);
}
return results;
};
this.ignoreCase=function(){
_usecase=false;
return self;
};
this.useCase=function(){
_usecase=true;
return self;
};
this.trim=function(){
_trim=true;
return self;
};
this.noTrim=function(){
_trim=false;
return self;
};
this.combine=function(f){
var q=$.from(_data);
if(!_usecase){ q.ignoreCase(); }
if(_trim){ q.trim(); }
var result=f(q).showQuery();
self._append(result);
return self;
};
this.execute=function(){
var match=_query, results=[];
if(match === null){
return self;
}
$.each(_data,function(){
if(eval(match)){results.push(this);}
});
_data=results;
return self;
};
this.data=function(){
return _data;
};
this.select=function(f){
self._performSort();
if(!self._hasData()){ return[]; }
self.execute();
if($.isFunction(f)){
var results=[];
$.each(_data,function(i,v){
results.push(f(v));
});
return results;
}
return _data;
};
this.hasMatch=function(f){
if(!self._hasData()) { return false; }
self.execute();
return _data.length>0;
};
this.showQuery=function(cmd){
var queryString=_query;
if(queryString === null) { queryString="no query found"; }
if($.isFunction(cmd)){
cmd(queryString);return self;
}
return queryString;
};
this.andNot=function(f,v,x){
_negate=!_negate;
return self.and(f,v,x);
};
this.orNot=function(f,v,x){
_negate=!_negate;
return self.or(f,v,x);
};
this.not=function(f,v,x){
return self.andNot(f,v,x);
};
this.and=function(f,v,x){
_queuedOperator=" && ";
if(f===undefined){
return self;
}
return self._repeatCommand(f,v,x);
};
this.or=function(f,v,x){
_queuedOperator=" || ";
if(f===undefined) { return self; }
return self._repeatCommand(f,v,x);
};
this.isNot=function(f){
_negate=!_negate;
return self.is(f);
};
this.is=function(f){
self._append('this.'+f);
self._resetNegate();
return self;
};
this._compareValues=function(func,f,v,how,t){
var fld;
if(_useProperties){
fld='this.'+f;
}else{
fld='this';
}
if(v===undefined) { v = null; }
var val=v===null?f:v,
swst = t.stype === undefined ? "text" : t.stype;
switch(swst) {
case 'int':
case 'integer':
val = isNaN(Number(val)) ? '0' : val; // To be fixed with more inteligent code
fld = 'parseInt('+fld+',10)';
val = 'parseInt('+val+',10)';
break;
case 'float':
case 'number':
case 'numeric':
val = String(val).replace(_stripNum, '');
val = isNaN(Number(val)) ? '0' : val; // To be fixed with more inteligent code
fld = 'parseFloat('+fld+')';
val = 'parseFloat('+val+')';
break;
case 'date':
case 'datetime':
val = String($.jgrid.parseDate(t.newfmt || 'Y-m-d',val).getTime());
fld = 'jQuery.jgrid.parseDate("'+t.srcfmt+'",'+fld+').getTime()';
break;
default :
fld=self._getStr(fld);
val=self._getStr('"'+self._toStr(val)+'"');
}
self._append(fld+' '+how+' '+val);
self._setCommand(func,f);
self._resetNegate();
return self;
};
this.equals=function(f,v,t){
return self._compareValues(self.equals,f,v,"==",t);
};
this.greater=function(f,v,t){
return self._compareValues(self.greater,f,v,">",t);
};
this.less=function(f,v,t){
return self._compareValues(self.less,f,v,"<",t);
};
this.greaterOrEquals=function(f,v,t){
return self._compareValues(self.greaterOrEquals,f,v,">=",t);
};
this.lessOrEquals=function(f,v,t){
return self._compareValues(self.lessOrEquals,f,v,"<=",t);
};
this.startsWith=function(f,v){
var val = (v===undefined || v===null) ? f: v,
length=_trim ? $.trim(val.toString()).length : val.toString().length;
if(_useProperties){
self._append(self._getStr('this.'+f)+'.substr(0,'+length+') == '+self._getStr('"'+self._toStr(v)+'"'));
}else{
length=_trim?$.trim(v.toString()).length:v.toString().length;
self._append(self._getStr('this')+'.substr(0,'+length+') == '+self._getStr('"'+self._toStr(f)+'"'));
}
self._setCommand(self.startsWith,f);
self._resetNegate();
return self;
};
this.endsWith=function(f,v){
var val = (v===undefined || v===null) ? f: v,
length=_trim ? $.trim(val.toString()).length:val.toString().length;
if(_useProperties){
self._append(self._getStr('this.'+f)+'.substr('+self._getStr('this.'+f)+'.length-'+length+','+length+') == "'+self._toStr(v)+'"');
} else {
self._append(self._getStr('this')+'.substr('+self._getStr('this')+'.length-"'+self._toStr(f)+'".length,"'+self._toStr(f)+'".length) == "'+self._toStr(f)+'"');
}
self._setCommand(self.endsWith,f);self._resetNegate();
return self;
};
this.contains=function(f,v){
if(_useProperties){
self._append(self._getStr('this.'+f)+'.indexOf("'+self._toStr(v)+'",0) > -1');
}else{
self._append(self._getStr('this')+'.indexOf("'+self._toStr(f)+'",0) > -1');
}
self._setCommand(self.contains,f);
self._resetNegate();
return self;
};
this.groupBy=function(by,dir,type, datefmt){
if(!self._hasData()){
return null;
}
return self._getGroup(_data,by,dir,type, datefmt);
};
this.orderBy=function(by,dir,stype, dfmt){
dir = dir === undefined || dir === null ? "a" :$.trim(dir.toString().toLowerCase());
if(stype === null || stype === undefined) { stype = "text"; }
if(dfmt === null || dfmt === undefined) { dfmt = "Y-m-d"; }
if(dir=="desc"||dir=="descending"){dir="d";}
if(dir=="asc"||dir=="ascending"){dir="a";}
_sorting.push({by:by,dir:dir,type:stype, datefmt: dfmt});
return self;
};
return self;
};
return new queryObject(source,null);
},
extend : function(methods) {
$.extend($.fn.jqGrid,methods);
if (!this.no_legacy_api) {
$.fn.extend(methods);
}
}
});
$.fn.jqGrid = function( pin ) {
if (typeof pin == 'string') {
//var fn = $.fn.jqGrid[pin];
var fn = $.jgrid.getAccessor($.fn.jqGrid,pin);
if (!fn) {
throw ("jqGrid - No such method: " + pin);
}
var args = $.makeArray(arguments).slice(1);
return fn.apply(this,args);
}
return this.each( function() {
if(this.grid) {return;}
var p = $.extend(true,{
url: "",
height: 150,
page: 1,
rowNum: 20,
rowTotal : null,
records: 0,
pager: "",
pgbuttons: true,
pginput: true,
colModel: [],
rowList: [],
colNames: [],
sortorder: "asc",
sortname: "",
datatype: "xml",
mtype: "GET",
altRows: false,
selarrrow: [],
savedRow: [],
shrinkToFit: true,
xmlReader: {},
jsonReader: {},
subGrid: false,
subGridModel :[],
reccount: 0,
lastpage: 0,
lastsort: 0,
selrow: null,
beforeSelectRow: null,
onSelectRow: null,
onSortCol: null,
ondblClickRow: null,
onRightClickRow: null,
onPaging: null,
onSelectAll: null,
loadComplete: null,
gridComplete: null,
loadError: null,
loadBeforeSend: null,
afterInsertRow: null,
beforeRequest: null,
onHeaderClick: null,
viewrecords: false,
loadonce: false,
multiselect: false,
multikey: false,
editurl: null,
search: false,
caption: "",
hidegrid: true,
hiddengrid: false,
postData: {},
userData: {},
treeGrid : false,
treeGridModel : 'nested',
treeReader : {},
treeANode : -1,
ExpandColumn: null,
tree_root_level : 0,
prmNames: {page:"page",rows:"rows", sort: "sidx",order: "sord", search:"_search", nd:"nd", id:"id",oper:"oper",editoper:"edit",addoper:"add",deloper:"del", subgridid:"id", npage: null, totalrows:"totalrows"},
forceFit : false,
gridstate : "visible",
cellEdit: false,
cellsubmit: "remote",
nv:0,
loadui: "enable",
toolbar: [false,""],
scroll: false,
multiboxonly : false,
deselectAfterSort : true,
scrollrows : false,
autowidth: false,
scrollOffset :18,
cellLayout: 5,
subGridWidth: 20,
multiselectWidth: 20,
gridview: false,
rownumWidth: 25,
rownumbers : false,
pagerpos: 'center',
recordpos: 'right',
footerrow : false,
userDataOnFooter : false,
hoverrows : true,
altclass : 'ui-priority-secondary',
viewsortcols : [false,'vertical',true],
resizeclass : '',
autoencode : false,
remapColumns : [],
ajaxGridOptions :{},
direction : "ltr",
toppager: false,
headertitles: false,
scrollTimeout: 40,
data : [],
_index : {},
grouping : false,
groupingView : {groupField:[],groupOrder:[], groupText:[],groupColumnShow:[],groupSummary:[], showSummaryOnHide: false, sortitems:[], sortnames:[], groupDataSorted : false, summary:[],summaryval:[], plusicon: 'ui-icon-circlesmall-plus', minusicon: 'ui-icon-circlesmall-minus'},
ignoreCase : false,
cmTemplate : {}
}, $.jgrid.defaults, pin || {});
var grid={
headers:[],
cols:[],
footers: [],
dragStart: function(i,x,y) {
this.resizing = { idx: i, startX: x.clientX, sOL : y[0]};
this.hDiv.style.cursor = "col-resize";
this.curGbox = $("#rs_m"+p.id,"#gbox_"+p.id);
this.curGbox.css({display:"block",left:y[0],top:y[1],height:y[2]});
if($.isFunction(p.resizeStart)) { p.resizeStart.call(this,x,i); }
document.onselectstart=function(){return false;};
},
dragMove: function(x) {
if(this.resizing) {
var diff = x.clientX-this.resizing.startX,
h = this.headers[this.resizing.idx],
newWidth = p.direction === "ltr" ? h.width + diff : h.width - diff, hn, nWn;
if(newWidth > 33) {
this.curGbox.css({left:this.resizing.sOL+diff});
if(p.forceFit===true ){
hn = this.headers[this.resizing.idx+p.nv];
nWn = p.direction === "ltr" ? hn.width - diff : hn.width + diff;
if(nWn >33) {
h.newWidth = newWidth;
hn.newWidth = nWn;
}
} else {
this.newWidth = p.direction === "ltr" ? p.tblwidth+diff : p.tblwidth-diff;
h.newWidth = newWidth;
}
}
}
},
dragEnd: function() {
this.hDiv.style.cursor = "default";
if(this.resizing) {
var idx = this.resizing.idx,
nw = this.headers[idx].newWidth || this.headers[idx].width;
nw = parseInt(nw,10);
this.resizing = false;
$("#rs_m"+p.id).css("display","none");
p.colModel[idx].width = nw;
this.headers[idx].width = nw;
this.headers[idx].el.style.width = nw + "px";
this.cols[idx].style.width = nw+"px";
if(this.footers.length>0) {this.footers[idx].style.width = nw+"px";}
if(p.forceFit===true){
nw = this.headers[idx+p.nv].newWidth || this.headers[idx+p.nv].width;
this.headers[idx+p.nv].width = nw;
this.headers[idx+p.nv].el.style.width = nw + "px";
this.cols[idx+p.nv].style.width = nw+"px";
if(this.footers.length>0) {this.footers[idx+p.nv].style.width = nw+"px";}
p.colModel[idx+p.nv].width = nw;
} else {
p.tblwidth = this.newWidth || p.tblwidth;
$('table:first',this.bDiv).css("width",p.tblwidth+"px");
$('table:first',this.hDiv).css("width",p.tblwidth+"px");
this.hDiv.scrollLeft = this.bDiv.scrollLeft;
if(p.footerrow) {
$('table:first',this.sDiv).css("width",p.tblwidth+"px");
this.sDiv.scrollLeft = this.bDiv.scrollLeft;
}
}
if($.isFunction(p.resizeStop)) { p.resizeStop.call(this,nw,idx); }
}
this.curGbox = null;
document.onselectstart=function(){return true;};
},
populateVisible: function() {
if (grid.timer) { clearTimeout(grid.timer); }
grid.timer = null;
var dh = $(grid.bDiv).height();
if (!dh) { return; }
var table = $("table:first", grid.bDiv);
var rows = $("> tbody > tr:gt(0):visible:first", table);
var rh = rows.outerHeight() || grid.prevRowHeight;
if (!rh) { return; }
grid.prevRowHeight = rh;
var rn = p.rowNum;
var scrollTop = grid.scrollTop = grid.bDiv.scrollTop;
var ttop = Math.round(table.position().top) - scrollTop;
var tbot = ttop + table.height();
var div = rh * rn;
var page, npage, empty;
if ( tbot < dh && ttop <= 0 &&
(p.lastpage===undefined||parseInt((tbot + scrollTop + div - 1) / div,10) <= p.lastpage))
{
npage = parseInt((dh - tbot + div - 1) / div,10);
if (tbot >= 0 || npage < 2 || p.scroll === true) {
page = Math.round((tbot + scrollTop) / div) + 1;
ttop = -1;
} else {
ttop = 1;
}
}
if (ttop > 0) {
page = parseInt(scrollTop / div,10) + 1;
npage = parseInt((scrollTop + dh) / div,10) + 2 - page;
empty = true;
}
if (npage) {
if (p.lastpage && page > p.lastpage || p.lastpage==1) {
return;
}
if (grid.hDiv.loading) {
grid.timer = setTimeout(grid.populateVisible, p.scrollTimeout);
} else {
p.page = page;
if (empty) {
grid.selectionPreserver(table[0]);
grid.emptyRows(grid.bDiv,false);
}
grid.populate(npage);
}
}
},
scrollGrid: function() {
if(p.scroll) {
var scrollTop = grid.bDiv.scrollTop;
if(grid.scrollTop === undefined) { grid.scrollTop = 0; }
if (scrollTop != grid.scrollTop) {
grid.scrollTop = scrollTop;
if (grid.timer) { clearTimeout(grid.timer); }
grid.timer = setTimeout(grid.populateVisible, p.scrollTimeout);
}
}
grid.hDiv.scrollLeft = grid.bDiv.scrollLeft;
if(p.footerrow) {
grid.sDiv.scrollLeft = grid.bDiv.scrollLeft;
}
},
selectionPreserver : function(ts) {
var p = ts.p;
var sr = p.selrow, sra = p.selarrrow ? $.makeArray(p.selarrrow) : null;
var left = ts.grid.bDiv.scrollLeft;
var complete = p.gridComplete;
p.gridComplete = function() {
p.selrow = null;
p.selarrrow = [];
if(p.multiselect && sra && sra.length>0) {
for(var i=0;i<sra.length;i++){
if (sra[i] != sr) {
$(ts).jqGrid("setSelection",sra[i],false);
}
}
}
if (sr) {
$(ts).jqGrid("setSelection",sr,false);
}
ts.grid.bDiv.scrollLeft = left;
p.gridComplete = complete;
if (p.gridComplete) {
complete();
}
};
}
};
if(this.tagName != 'TABLE') {
alert("Element is not a table");
return;
}
$(this).empty();
this.p = p ;
var i, dir,ts, clm;
if(this.p.colNames.length === 0) {
for (i=0;i<this.p.colModel.length;i++){
this.p.colNames[i] = this.p.colModel[i].label || this.p.colModel[i].name;
}
}
if( this.p.colNames.length !== this.p.colModel.length ) {
alert($.jgrid.errors.model);
return;
}
var gv = $("<div class='ui-jqgrid-view'></div>"), ii,
isMSIE = $.browser.msie ? true:false,
isSafari = $.browser.safari ? true : false;
ts = this;
ts.p.direction = $.trim(ts.p.direction.toLowerCase());
if($.inArray(ts.p.direction,["ltr","rtl"]) == -1) { ts.p.direction = "ltr"; }
dir = ts.p.direction;
$(gv).insertBefore(this);
$(this).appendTo(gv).removeClass("scroll");
var eg = $("<div class='ui-jqgrid ui-widget ui-widget-content ui-corner-all'></div>");
$(eg).insertBefore(gv).attr({"id" : "gbox_"+this.id,"dir":dir});
$(gv).appendTo(eg).attr("id","gview_"+this.id);
if (isMSIE && $.browser.version <= 6) {
ii = '<iframe style="display:block;position:absolute;z-index:-1;filter:Alpha(Opacity=\'0\');" src="javascript:false;"></iframe>';
} else { ii="";}
$("<div class='ui-widget-overlay jqgrid-overlay' id='lui_"+this.id+"'></div>").append(ii).insertBefore(gv);
$("<div class='loading ui-state-default ui-state-active' id='load_"+this.id+"'>"+this.p.loadtext+"</div>").insertBefore(gv);
$(this).attr({cellspacing:"0",cellpadding:"0",border:"0","role":"grid","aria-multiselectable":!!this.p.multiselect,"aria-labelledby":"gbox_"+this.id});
var sortkeys = ["shiftKey","altKey","ctrlKey"],
intNum = function(val,defval) {
val = parseInt(val,10);
if (isNaN(val)) { return defval ? defval : 0;}
else {return val;}
},
formatCol = function (pos, rowInd, tv){
var cm = ts.p.colModel[pos],
ral = cm.align, result="style=\"", clas = cm.classes, nm = cm.name;
if(ral) { result += "text-align:"+ral+";"; }
if(cm.hidden===true) { result += "display:none;"; }
if(rowInd===0) {
result += "width: "+grid.headers[pos].width+"px;";
}
result += "\"" + (clas !== undefined ? (" class=\""+clas+"\"") :"") + ((cm.title && tv) ? (" title=\""+$.jgrid.stripHtml(tv)+"\"") :"");
result += " aria-describedby=\""+ts.p.id+"_"+nm+"\"";
return result;
},
cellVal = function (val) {
return val === undefined || val === null || val === "" ? " " : (ts.p.autoencode ? $.jgrid.htmlEncode(val) : val+"");
},
formatter = function (rowId, cellval , colpos, rwdat, _act){
var cm = ts.p.colModel[colpos],v;
if(typeof cm.formatter !== 'undefined') {
var opts= {rowId: rowId, colModel:cm, gid:ts.p.id, pos:colpos };
if($.isFunction( cm.formatter ) ) {
v = cm.formatter.call(ts,cellval,opts,rwdat,_act);
} else if($.fmatter){
v = $.fn.fmatter(cm.formatter, cellval,opts, rwdat, _act);
} else {
v = cellVal(cellval);
}
} else {
v = cellVal(cellval);
}
return v;
},
addCell = function(rowId,cell,pos,irow, srvr) {
var v,prp;
v = formatter(rowId,cell,pos,srvr,'add');
prp = formatCol( pos,irow, v);
return "<td role=\"gridcell\" "+prp+">"+v+"</td>";
},
addMulti = function(rowid,pos,irow){
var v = "<input role=\"checkbox\" type=\"checkbox\""+" id=\"jqg_"+ts.p.id+"_"+rowid+"\" class=\"cbox\" name=\"jqg_"+ts.p.id+"_"+rowid+"\"/>",
prp = formatCol(pos,irow,'');
return "<td role=\"gridcell\" "+prp+">"+v+"</td>";
},
addRowNum = function (pos,irow,pG,rN) {
var v = (parseInt(pG,10)-1)*parseInt(rN,10)+1+irow,
prp = formatCol(pos,irow,'');
return "<td role=\"gridcell\" class=\"ui-state-default jqgrid-rownum\" "+prp+">"+v+"</td>";
},
reader = function (datatype) {
var field, f=[], j=0, i;
for(i =0; i<ts.p.colModel.length; i++){
field = ts.p.colModel[i];
if (field.name !== 'cb' && field.name !=='subgrid' && field.name !=='rn') {
if(datatype == "local") {
f[j] = field.name;
} else {
f[j] = (datatype=="xml") ? field.xmlmap || field.name : field.jsonmap || field.name;
}
j++;
}
}
return f;
},
orderedCols = function (offset) {
var order = ts.p.remapColumns;
if (!order || !order.length) {
order = $.map(ts.p.colModel, function(v,i) { return i; });
}
if (offset) {
order = $.map(order, function(v) { return v<offset?null:v-offset; });
}
return order;
},
emptyRows = function (parent, scroll) {
if(ts.p.deepempty) {$("#"+ts.p.id+" tbody:first tr:gt(0)").remove();}
else {
var trf = $("#"+ts.p.id+" tbody:first tr:first")[0];
$("#"+ts.p.id+" tbody:first").empty().append(trf);
}
if (scroll && ts.p.scroll) {
$(">div:first", parent).css({height:"auto"}).children("div:first").css({height:0,display:"none"});
parent.scrollTop = 0;
}
},
refreshIndex = function() {
var datalen = ts.p.data.length, idname, i, val,
ni = ts.p.rownumbers===true ? 1 :0,
gi = ts.p.multiselect ===true ? 1 :0,
si = ts.p.subGrid===true ? 1 :0;
if(ts.p.keyIndex === false || ts.p.loadonce === true) {
idname = ts.p.localReader.id;
} else {
idname = ts.p.colModel[ts.p.keyIndex+gi+si+ni].name;
}
for(i =0;i < datalen; i++) {
val = $.jgrid.getAccessor(ts.p.data[i],idname);
ts.p._index[val] = i;
}
},
addXmlData = function (xml,t, rcnt, more, adjust) {
var startReq = new Date(),
locdata = (ts.p.datatype != "local" && ts.p.loadonce) || ts.p.datatype == "xmlstring",
xmlid,
frd = ts.p.datatype == "local" ? "local" : "xml";
if(locdata) {
ts.p.data = [];
ts.p._index = {};
ts.p.localReader.id = xmlid = "_id_";
}
ts.p.reccount = 0;
if($.isXMLDoc(xml)) {
if(ts.p.treeANode===-1 && !ts.p.scroll) {
emptyRows(t,false);
rcnt=1;
} else { rcnt = rcnt > 1 ? rcnt :1; }
} else { return; }
var i,fpos,ir=0,v,row,gi=0,si=0,ni=0,idn, getId,f=[],F,rd ={}, xmlr,rid, rowData=[], cn=(ts.p.altRows === true) ? " "+ts.p.altclass:"",cn1;
if(!ts.p.xmlReader.repeatitems) {f = reader(frd);}
if( ts.p.keyIndex===false) {
idn = ts.p.xmlReader.id;
} else {
idn = ts.p.keyIndex;
}
if(f.length>0 && !isNaN(idn)) {
if (ts.p.remapColumns && ts.p.remapColumns.length) {
idn = $.inArray(idn, ts.p.remapColumns);
}
idn=f[idn];
}
if( (idn+"").indexOf("[") === -1 ) {
if (f.length) {
getId = function( trow, k) {return $(idn,trow).text() || k;};
} else {
getId = function( trow, k) {return $(ts.p.xmlReader.cell,trow).eq(idn).text() || k;};
}
}
else {
getId = function( trow, k) {return trow.getAttribute(idn.replace(/[\[\]]/g,"")) || k;};
}
ts.p.userData = {};
$(ts.p.xmlReader.page,xml).each(function() {ts.p.page = this.textContent || this.text || 0; });
$(ts.p.xmlReader.total,xml).each(function() {ts.p.lastpage = this.textContent || this.text; if(ts.p.lastpage===undefined) { ts.p.lastpage=1; } } );
$(ts.p.xmlReader.records,xml).each(function() {ts.p.records = this.textContent || this.text || 0; } );
$(ts.p.xmlReader.userdata,xml).each(function() {ts.p.userData[this.getAttribute("name")]=this.textContent || this.text;});
var gxml = $(ts.p.xmlReader.root+" "+ts.p.xmlReader.row,xml);
if (!gxml) { gxml = []; }
var gl = gxml.length, j=0;
if(gxml && gl){
var rn = parseInt(ts.p.rowNum,10),br=ts.p.scroll?(parseInt(ts.p.page,10)-1)*rn+1:1,altr;
if (adjust) { rn *= adjust+1; }
var afterInsRow = $.isFunction(ts.p.afterInsertRow), grpdata={}, hiderow="";
if(ts.p.grouping && ts.p.groupingView.groupCollapse === true) {
hiderow = " style=\"display:none;\"";
}
while (j<gl) {
xmlr = gxml[j];
rid = getId(xmlr,br+j);
altr = rcnt === 0 ? 0 : rcnt+1;
cn1 = (altr+j)%2 == 1 ? cn : '';
rowData.push( "<tr"+hiderow+" id=\""+rid+"\" role=\"row\" class =\"ui-widget-content jqgrow ui-row-"+ts.p.direction+""+cn1+"\">" );
if(ts.p.rownumbers===true) {
rowData.push( addRowNum(0,j,ts.p.page,ts.p.rowNum) );
ni=1;
}
if(ts.p.multiselect===true) {
rowData.push( addMulti(rid,ni,j) );
gi=1;
}
if (ts.p.subGrid===true) {
rowData.push( $(ts).jqGrid("addSubGridCell",gi+ni,j+rcnt) );
si= 1;
}
if(ts.p.xmlReader.repeatitems){
if (!F) { F=orderedCols(gi+si+ni); }
var cells = $(ts.p.xmlReader.cell,xmlr);
$.each(F, function (k) {
var cell = cells[this];
if (!cell) { return false; }
v = cell.textContent || cell.text;
rd[ts.p.colModel[k+gi+si+ni].name] = v;
rowData.push( addCell(rid,v,k+gi+si+ni,j+rcnt,xmlr) );
});
} else {
for(i = 0; i < f.length;i++) {
v = $(f[i],xmlr).text();
rd[ts.p.colModel[i+gi+si+ni].name] = v;
rowData.push( addCell(rid, v, i+gi+si+ni, j+rcnt, xmlr) );
}
}
rowData.push("</tr>");
if(ts.p.grouping) {
var grlen = ts.p.groupingView.groupField.length, grpitem = [];
for(var z=0;z<grlen;z++) {
grpitem.push(rd[ts.p.groupingView.groupField[z]]);
}
grpdata = $(ts).jqGrid('groupingPrepare',rowData, grpitem, grpdata, rd);
rowData = [];
}
if(locdata) {
rd[xmlid] = rid;
ts.p.data.push(rd);
}
if(ts.p.gridview === false ) {
if( ts.p.treeGrid === true) {
fpos = ts.p.treeANode > -1 ? ts.p.treeANode: 0;
row = $(rowData.join(''))[0]; // speed overhead
$(ts.rows[j+fpos]).after(row);
try {$(ts).jqGrid("setTreeNode",rd,row);} catch (e) {}
} else {
$("tbody:first",t).append(rowData.join(''));
}
if (ts.p.subGrid===true) {
try {$(ts).jqGrid("addSubGrid",ts.rows[ts.rows.length-1],gi+ni);} catch (_){}
}
if(afterInsRow) {ts.p.afterInsertRow.call(ts,rid,rd,xmlr);}
rowData=[];
}
rd={};
ir++;
j++;
if(ir==rn) {break;}
}
}
if(ts.p.gridview === true) {
if(ts.p.grouping) {
$(ts).jqGrid('groupingRender',grpdata,ts.p.colModel.length);
grpdata = null;
} else {
$("tbody:first",t).append(rowData.join(''));
}
}
ts.p.totaltime = new Date() - startReq;
if(ir>0) { if(ts.p.records===0) { ts.p.records=gl;} }
rowData =null;
if(!ts.p.treeGrid && !ts.p.scroll) {ts.grid.bDiv.scrollTop = 0;}
ts.p.reccount=ir;
ts.p.treeANode = -1;
if(ts.p.userDataOnFooter) { $(ts).jqGrid("footerData","set",ts.p.userData,true); }
if(locdata) {
ts.p.records = gl;
ts.p.lastpage = Math.ceil(gl/ rn);
}
if (!more) { ts.updatepager(false,true); }
if(locdata) {
while (ir<gl) {
xmlr = gxml[ir];
rid = getId(xmlr,ir);
if(ts.p.xmlReader.repeatitems){
if (!F) { F=orderedCols(gi+si+ni); }
var cells2 = $(ts.p.xmlReader.cell,xmlr);
$.each(F, function (k) {
var cell = cells2[this];
if (!cell) { return false; }
v = cell.textContent || cell.text;
rd[ts.p.colModel[k+gi+si+ni].name] = v;
});
} else {
for(i = 0; i < f.length;i++) {
v = $(f[i],xmlr).text();
rd[ts.p.colModel[i+gi+si+ni].name] = v;
}
}
rd[xmlid] = rid;
ts.p.data.push(rd);
rd = {};
ir++;
}
refreshIndex();
}
},
addJSONData = function(data,t, rcnt, more, adjust) {
var startReq = new Date();
if(data) {
if(ts.p.treeANode === -1 && !ts.p.scroll) {
emptyRows(t,false);
rcnt=1;
} else { rcnt = rcnt > 1 ? rcnt :1; }
} else { return; }
var dReader, locid, frd,
locdata = (ts.p.datatype != "local" && ts.p.loadonce) || ts.p.datatype == "jsonstring";
if(locdata) { ts.p.data = []; ts.p._index = {}; locid = ts.p.localReader.id = "_id_";}
ts.p.reccount = 0;
if(ts.p.datatype == "local") {
dReader = ts.p.localReader;
frd= 'local';
} else {
dReader = ts.p.jsonReader;
frd='json';
}
var ir=0,v,i,j,row,f=[],F,cur,gi=0,si=0,ni=0,len,drows,idn,rd={}, fpos, idr,rowData=[],cn=(ts.p.altRows === true) ? " "+ts.p.altclass:"",cn1,lp;
ts.p.page = $.jgrid.getAccessor(data,dReader.page) || 0;
lp = $.jgrid.getAccessor(data,dReader.total);
ts.p.lastpage = lp === undefined ? 1 : lp;
ts.p.records = $.jgrid.getAccessor(data,dReader.records) || 0;
ts.p.userData = $.jgrid.getAccessor(data,dReader.userdata) || {};
if(!dReader.repeatitems) {
F = f = reader(frd);
}
if( ts.p.keyIndex===false ) {
idn = dReader.id;
} else {
idn = ts.p.keyIndex;
}
if(f.length>0 && !isNaN(idn)) {
if (ts.p.remapColumns && ts.p.remapColumns.length) {
idn = $.inArray(idn, ts.p.remapColumns);
}
idn=f[idn];
}
drows = $.jgrid.getAccessor(data,dReader.root);
if (!drows) { drows = []; }
len = drows.length; i=0;
var rn = parseInt(ts.p.rowNum,10),br=ts.p.scroll?(parseInt(ts.p.page,10)-1)*rn+1:1, altr;
if (adjust) { rn *= adjust+1; }
var afterInsRow = $.isFunction(ts.p.afterInsertRow), grpdata={}, hiderow="";
if(ts.p.grouping && ts.p.groupingView.groupCollapse === true) {
hiderow = " style=\"display:none;\"";
}
while (i<len) {
cur = drows[i];
idr = $.jgrid.getAccessor(cur,idn);
if(idr === undefined) {
idr = br+i;
if(f.length===0){
if(dReader.cell){
var ccur = cur[dReader.cell];
idr = ccur[idn] || idr;
ccur=null;
}
}
}
altr = rcnt === 1 ? 0 : rcnt;
cn1 = (altr+i)%2 == 1 ? cn : '';
rowData.push("<tr"+hiderow+" id=\""+ idr +"\" role=\"row\" class= \"ui-widget-content jqgrow ui-row-"+ts.p.direction+""+cn1+"\">");
if(ts.p.rownumbers===true) {
rowData.push( addRowNum(0,i,ts.p.page,ts.p.rowNum) );
ni=1;
}
if(ts.p.multiselect){
rowData.push( addMulti(idr,ni,i) );
gi = 1;
}
if (ts.p.subGrid) {
rowData.push( $(ts).jqGrid("addSubGridCell",gi+ni,i+rcnt) );
si= 1;
}
if (dReader.repeatitems) {
if(dReader.cell) {cur = $.jgrid.getAccessor(cur,dReader.cell);}
if (!F) { F=orderedCols(gi+si+ni); }
}
for (j=0;j<F.length;j++) {
v = $.jgrid.getAccessor(cur,F[j]);
rowData.push( addCell(idr,v,j+gi+si+ni,i+rcnt,cur) );
rd[ts.p.colModel[j+gi+si+ni].name] = v;
}
rowData.push( "</tr>" );
if(ts.p.grouping) {
var grlen = ts.p.groupingView.groupField.length, grpitem = [];
for(var z=0;z<grlen;z++) {
grpitem.push(rd[ts.p.groupingView.groupField[z]]);
}
grpdata = $(ts).jqGrid('groupingPrepare',rowData, grpitem, grpdata, rd);
rowData = [];
}
if(locdata) { rd[locid] = idr; ts.p.data.push(rd); }
if(ts.p.gridview === false ) {
if( ts.p.treeGrid === true) {
fpos = ts.p.treeANode > -1 ? ts.p.treeANode: 0;
row = $(rowData.join(''))[0];
$(ts.rows[i+fpos]).after(row);
try {$(ts).jqGrid("setTreeNode",rd,row);} catch (e) {}
} else {
$("#"+ts.p.id+" tbody:first").append(rowData.join(''));
}
if(ts.p.subGrid === true ) {
try { $(ts).jqGrid("addSubGrid",ts.rows[ts.rows.length-1],gi+ni);} catch (_){}
}
if(afterInsRow) {ts.p.afterInsertRow.call(ts,idr,rd,cur);}
rowData=[];//ari=0;
}
rd={};
ir++;
i++;
if(ir==rn) { break; }
}
if(ts.p.gridview === true ) {
if(ts.p.grouping) {
$(ts).jqGrid('groupingRender',grpdata,ts.p.colModel.length);
grpdata = null;
} else {
$("#"+ts.p.id+" tbody:first").append(rowData.join(''));
}
}
ts.p.totaltime = new Date() - startReq;
if(ir>0) {
if(ts.p.records===0) { ts.p.records=len; }
}
rowData = null;
if(!ts.p.treeGrid && !ts.p.scroll) {ts.grid.bDiv.scrollTop = 0;}
ts.p.reccount=ir;
ts.p.treeANode = -1;
if(ts.p.userDataOnFooter) { $(ts).jqGrid("footerData","set",ts.p.userData,true); }
if(locdata) {
ts.p.records = len;
ts.p.lastpage = Math.ceil(len/ rn);
}
if (!more) { ts.updatepager(false,true); }
if(locdata) {
while (ir<len) {
cur = drows[ir];
idr = $.jgrid.getAccessor(cur,idn);
if(idr === undefined) {
idr = br+ir;
if(f.length===0){
if(dReader.cell){
var ccur2 = cur[dReader.cell];
idr = ccur2[idn] || idr;
ccur2=null;
}
}
}
if(cur) {
if (dReader.repeatitems) {
if(dReader.cell) {cur = $.jgrid.getAccessor(cur,dReader.cell);}
if (!F) { F=orderedCols(gi+si+ni); }
}
for (j=0;j<F.length;j++) {
v = $.jgrid.getAccessor(cur,F[j]);
rd[ts.p.colModel[j+gi+si+ni].name] = v;
}
rd[locid] = idr;
ts.p.data.push(rd);
rd = {};
}
ir++;
}
refreshIndex();
}
},
addLocalData = function() {
var st, fndsort=false, cmtypes=[], grtypes=[], grindexes=[], srcformat, sorttype, newformat;
if(!$.isArray(ts.p.data)) {
return;
}
var grpview = ts.p.grouping ? ts.p.groupingView : false;
$.each(ts.p.colModel,function(i,v){
sorttype = this.sorttype || "text";
if(sorttype == "date" || sorttype == "datetime") {
if(this.formatter && typeof(this.formatter) === 'string' && this.formatter == 'date') {
if(this.formatoptions && this.formatoptions.srcformat) {
srcformat = this.formatoptions.srcformat;
} else {
srcformat = $.jgrid.formatter.date.srcformat;
}
if(this.formatoptions && this.formatoptions.newformat) {
newformat = this.formatoptions.newformat;
} else {
newformat = $.jgrid.formatter.date.newformat;
}
} else {
srcformat = newformat = this.datefmt || "Y-m-d";
}
cmtypes[this.name] = {"stype": sorttype, "srcfmt": srcformat,"newfmt":newformat};
} else {
cmtypes[this.name] = {"stype": sorttype, "srcfmt":'',"newfmt":''};
}
if(ts.p.grouping && this.name == grpview.groupField[0]) {
var grindex = this.name
if (typeof this.index != 'undefined') {
grindex = this.index;
}
grtypes[0] = cmtypes[grindex];
grindexes.push(grindex);
}
if(!fndsort && (this.index == ts.p.sortname || this.name == ts.p.sortname)){
st = this.name; // ???
fndsort = true;
}
});
if(ts.p.treeGrid) {
$(ts).jqGrid("SortTree", st, ts.p.sortorder, cmtypes[st].stype, cmtypes[st].srcfmt);
return;
}
var compareFnMap = {
'eq':function(queryObj) {return queryObj.equals;},
'ne':function(queryObj) {return queryObj.not().equals;},
'lt':function(queryObj) {return queryObj.less;},
'le':function(queryObj) {return queryObj.lessOrEquals;},
'gt':function(queryObj) {return queryObj.greater;},
'ge':function(queryObj) {return queryObj.greaterOrEquals;},
'cn':function(queryObj) {return queryObj.contains;},
'nc':function(queryObj) {return queryObj.not().contains;},
'bw':function(queryObj) {return queryObj.startsWith;},
'bn':function(queryObj) {return queryObj.not().startsWith;},
'en':function(queryObj) {return queryObj.not().endsWith;},
'ew':function(queryObj) {return queryObj.endsWith;},
'ni':function(queryObj) {return queryObj.not().equals;},
'in':function(queryObj) {return queryObj.equals;}
},
query = $.jgrid.from(ts.p.data);
if (ts.p.ignoreCase) { query = query.ignoreCase(); }
if (ts.p.search === true) {
var srules = ts.p.postData.filters, opr;
if(srules) {
if(typeof srules == "string") { srules = $.jgrid.parse(srules);}
for (var i=0, l= srules.rules.length, rule; i<l; i++) {
rule = srules.rules[i];
opr = srules.groupOp;
if (compareFnMap[rule.op] && rule.field && rule.data && opr) {
if(opr.toUpperCase() == "OR") {
query = compareFnMap[rule.op](query)(rule.field, rule.data, cmtypes[rule.field]).or();
} else {
query = compareFnMap[rule.op](query)(rule.field, rule.data, cmtypes[rule.field]);
}
}
}
} else {
try {
query = compareFnMap[ts.p.postData.searchOper](query)(ts.p.postData.searchField, ts.p.postData.searchString,cmtypes[ts.p.postData.searchField]);
} catch (se){}
}
}
if(ts.p.grouping) {
query.orderBy(grindexes,grpview.groupOrder[0],grtypes[0].stype, grtypes[0].srcfmt);
grpview.groupDataSorted = true;
}
if (st && ts.p.sortorder && fndsort) {
if(ts.p.sortorder.toUpperCase() == "DESC") {
query.orderBy(ts.p.sortname, "d", cmtypes[st].stype, cmtypes[st].srcfmt);
} else {
query.orderBy(ts.p.sortname, "a", cmtypes[st].stype, cmtypes[st].srcfmt);
}
}
var queryResults = query.select(),
recordsperpage = parseInt(ts.p.rowNum,10),
total = queryResults.length,
page = parseInt(ts.p.page,10),
totalpages = Math.ceil(total / recordsperpage),
retresult = {};
queryResults = queryResults.slice( (page-1)*recordsperpage , page*recordsperpage );
query = null;
cmtypes = null;
retresult[ts.p.localReader.total] = totalpages;
retresult[ts.p.localReader.page] = page;
retresult[ts.p.localReader.records] = total;
retresult[ts.p.localReader.root] = queryResults;
queryResults = null;
return retresult;
},
updatepager = function(rn, dnd) {
var cp, last, base, from,to,tot,fmt, pgboxes = "";
base = parseInt(ts.p.page,10)-1;
if(base < 0) { base = 0; }
base = base*parseInt(ts.p.rowNum,10);
to = base + ts.p.reccount;
if (ts.p.scroll) {
var rows = $("tbody:first > tr:gt(0)", ts.grid.bDiv);
base = to - rows.length;
ts.p.reccount = rows.length;
var rh = rows.outerHeight() || ts.grid.prevRowHeight;
if (rh) {
var top = base * rh;
var height = parseInt(ts.p.records,10) * rh;
$(">div:first",ts.grid.bDiv).css({height : height}).children("div:first").css({height:top,display:top?"":"none"});
}
ts.grid.bDiv.scrollLeft = ts.grid.hDiv.scrollLeft;
}
pgboxes = ts.p.pager ? ts.p.pager : "";
pgboxes += ts.p.toppager ? (pgboxes ? "," + ts.p.toppager : ts.p.toppager) : "";
if(pgboxes) {
fmt = $.jgrid.formatter.integer || {};
cp = intNum(ts.p.page);
last = intNum(ts.p.lastpage);
$(".selbox",pgboxes).attr("disabled",false);
if(ts.p.pginput===true) {
$('.ui-pg-input',pgboxes).val(ts.p.page);
$('#sp_1',pgboxes).html($.fmatter ? $.fmatter.util.NumberFormat(ts.p.lastpage,fmt):ts.p.lastpage);
}
if (ts.p.viewrecords){
if(ts.p.reccount === 0) {
$(".ui-paging-info",pgboxes).html(ts.p.emptyrecords);
} else {
from = base+1;
tot=ts.p.records;
if($.fmatter) {
from = $.fmatter.util.NumberFormat(from,fmt);
to = $.fmatter.util.NumberFormat(to,fmt);
tot = $.fmatter.util.NumberFormat(tot,fmt);
}
$(".ui-paging-info",pgboxes).html($.jgrid.format(ts.p.recordtext,from,to,tot));
}
}
if(ts.p.pgbuttons===true) {
if(cp<=0) {cp = last = 0;}
if(cp==1 || cp === 0) {
$("#first, #prev",ts.p.pager).addClass('ui-state-disabled').removeClass('ui-state-hover');
if(ts.p.toppager) { $("#first_t, #prev_t",ts.p.toppager).addClass('ui-state-disabled').removeClass('ui-state-hover'); }
} else {
$("#first, #prev",ts.p.pager).removeClass('ui-state-disabled');
if(ts.p.toppager) { $("#first_t, #prev_t",ts.p.toppager).removeClass('ui-state-disabled'); }
}
if(cp==last || cp === 0) {
$("#next, #last",ts.p.pager).addClass('ui-state-disabled').removeClass('ui-state-hover');
if(ts.p.toppager) { $("#next_t, #last_t",ts.p.toppager).addClass('ui-state-disabled').removeClass('ui-state-hover'); }
} else {
$("#next, #last",ts.p.pager).removeClass('ui-state-disabled');
if(ts.p.toppager) { $("#next_t, #last_t",ts.p.toppager).removeClass('ui-state-disabled'); }
}
}
}
if(rn===true && ts.p.rownumbers === true) {
$("td.jqgrid-rownum",ts.rows).each(function(i){
$(this).html(base+1+i);
});
}
if(dnd && ts.p.jqgdnd) { $(ts).jqGrid('gridDnD','updateDnD');}
if($.isFunction(ts.p.gridComplete)) {ts.p.gridComplete.call(ts);}
},
beginReq = function() {
ts.grid.hDiv.loading = true;
if(ts.p.hiddengrid) { return;}
switch(ts.p.loadui) {
case "disable":
break;
case "enable":
$("#load_"+ts.p.id).show();
break;
case "block":
$("#lui_"+ts.p.id).show();
$("#load_"+ts.p.id).show();
break;
}
},
endReq = function() {
ts.grid.hDiv.loading = false;
switch(ts.p.loadui) {
case "disable":
break;
case "enable":
$("#load_"+ts.p.id).hide();
break;
case "block":
$("#lui_"+ts.p.id).hide();
$("#load_"+ts.p.id).hide();
break;
}
},
populate = function (npage) {
if(!ts.grid.hDiv.loading) {
var pvis = ts.p.scroll && npage === false;
var prm = {}, dt, dstr, pN=ts.p.prmNames;
if(ts.p.page <=0) { ts.p.page = 1; }
if(pN.search !== null) {prm[pN.search] = ts.p.search;} if(pN.nd !== null) {prm[pN.nd] = new Date().getTime();}
if(pN.rows !== null) {prm[pN.rows]= ts.p.rowNum;} if(pN.page !== null) {prm[pN.page]= ts.p.page;}
if(pN.sort !== null) {prm[pN.sort]= ts.p.sortname;} if(pN.order !== null) {prm[pN.order]= ts.p.sortorder;}
if(ts.p.rowTotal !== null && pN.totalrows !== null) { prm[pN.totalrows]= ts.p.rowTotal; }
var lc = ts.p.loadComplete;
var lcf = $.isFunction(lc);
if (!lcf) { lc = null; }
var adjust = 0;
npage = npage || 1;
if (npage > 1) {
if(pN.npage !== null) {
prm[pN.npage] = npage;
adjust = npage - 1;
npage = 1;
} else {
lc = function(req) {
ts.p.page++;
ts.grid.hDiv.loading = false;
if (lcf) {
ts.p.loadComplete.call(ts,req);
}
populate(npage-1);
};
}
} else if (pN.npage !== null) {
delete ts.p.postData[pN.npage];
}
if(ts.p.grouping) {
$(ts).jqGrid('groupingSetup');
if(ts.p.groupingView.groupDataSorted === true) {
prm[pN.sort] = ts.p.groupingView.groupField[0] +" "+ ts.p.groupingView.groupOrder[0]+", "+prm[pN.sort];
}
}
$.extend(ts.p.postData,prm);
var rcnt = !ts.p.scroll ? 1 : ts.rows.length-1;
if ($.isFunction(ts.p.datatype)) { ts.p.datatype.call(ts,ts.p.postData,"load_"+ts.p.id); return;}
else if($.isFunction(ts.p.beforeRequest)) {ts.p.beforeRequest.call(ts);}
dt = ts.p.datatype.toLowerCase();
switch(dt)
{
case "json":
case "jsonp":
case "xml":
case "script":
$.ajax($.extend({
url:ts.p.url,
type:ts.p.mtype,
dataType: dt ,
data: $.isFunction(ts.p.serializeGridData)? ts.p.serializeGridData.call(ts,ts.p.postData) : ts.p.postData,
success:function(data,st) {
if(dt === "xml") { addXmlData(data,ts.grid.bDiv,rcnt,npage>1,adjust); }
else { addJSONData(data,ts.grid.bDiv,rcnt,npage>1,adjust); }
if(lc) { lc.call(ts,data); }
if (pvis) { ts.grid.populateVisible(); }
if( ts.p.loadonce || ts.p.treeGrid) {ts.p.datatype = "local";}
data=null;
endReq();
},
error:function(xhr,st,err){
if($.isFunction(ts.p.loadError)) { ts.p.loadError.call(ts,xhr,st,err); }
endReq();
xhr=null;
},
beforeSend: function(xhr){
beginReq();
if($.isFunction(ts.p.loadBeforeSend)) { ts.p.loadBeforeSend.call(ts,xhr); }
}
},$.jgrid.ajaxOptions, ts.p.ajaxGridOptions));
break;
case "xmlstring":
beginReq();
dstr = $.jgrid.stringToDoc(ts.p.datastr);
addXmlData(dstr,ts.grid.bDiv);
if(lcf) {ts.p.loadComplete.call(ts,dstr);}
ts.p.datatype = "local";
ts.p.datastr = null;
endReq();
break;
case "jsonstring":
beginReq();
if(typeof ts.p.datastr == 'string') { dstr = $.jgrid.parse(ts.p.datastr); }
else { dstr = ts.p.datastr; }
addJSONData(dstr,ts.grid.bDiv);
if(lcf) {ts.p.loadComplete.call(ts,dstr);}
ts.p.datatype = "local";
ts.p.datastr = null;
endReq();
break;
case "local":
case "clientside":
beginReq();
ts.p.datatype = "local";
var req = addLocalData();
addJSONData(req,ts.grid.bDiv,rcnt,npage>1,adjust);
if(lc) { lc.call(ts,req); }
if (pvis) { ts.grid.populateVisible(); }
endReq();
break;
}
}
},
setPager = function (pgid, tp){
var sep = "<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>",
pginp = "",
pgl="<table cellspacing='0' cellpadding='0' border='0' style='table-layout:auto;' class='ui-pg-table'><tbody><tr>",
str="", pgcnt, lft, cent, rgt, twd, tdw, i,
clearVals = function(onpaging){
var ret;
if ($.isFunction(ts.p.onPaging) ) { ret = ts.p.onPaging.call(ts,onpaging); }
ts.p.selrow = null;
if(ts.p.multiselect) {ts.p.selarrrow =[];$('#cb_'+$.jgrid.jqID(ts.p.id),ts.grid.hDiv).attr("checked",false);}
ts.p.savedRow = [];
if(ret=='stop') {return false;}
return true;
};
pgid = pgid.substr(1);
pgcnt = "pg_"+pgid;
lft = pgid+"_left"; cent = pgid+"_center"; rgt = pgid+"_right";
$("#"+pgid)
.append("<div id='"+pgcnt+"' class='ui-pager-control' role='group'><table cellspacing='0' cellpadding='0' border='0' class='ui-pg-table' style='width:100%;table-layout:fixed;height:100%;' role='row'><tbody><tr><td id='"+lft+"' align='left'></td><td id='"+cent+"' align='center' style='white-space:pre;'></td><td id='"+rgt+"' align='right'></td></tr></tbody></table></div>")
.attr("dir","ltr"); //explicit setting
if(ts.p.rowList.length >0){
str = "<td dir='"+dir+"'>";
str +="<select class='ui-pg-selbox' role='listbox'>";
for(i=0;i<ts.p.rowList.length;i++){
str +="<option role=\"option\" value=\""+ts.p.rowList[i]+"\""+((ts.p.rowNum == ts.p.rowList[i])?" selected=\"selected\"":"")+">"+ts.p.rowList[i]+"</option>";
}
str +="</select></td>";
}
if(dir=="rtl") { pgl += str; }
if(ts.p.pginput===true) { pginp= "<td dir='"+dir+"'>"+$.jgrid.format(ts.p.pgtext || "","<input class='ui-pg-input' type='text' size='2' maxlength='7' value='0' role='textbox'/>","<span id='sp_1'></span>")+"</td>";}
if(ts.p.pgbuttons===true) {
var po=["first"+tp,"prev"+tp, "next"+tp,"last"+tp]; if(dir=="rtl") { po.reverse(); }
pgl += "<td id='"+po[0]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-first'></span></td>";
pgl += "<td id='"+po[1]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-prev'></span></td>";
pgl += pginp !== "" ? sep+pginp+sep:"";
pgl += "<td id='"+po[2]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-next'></span></td>";
pgl += "<td id='"+po[3]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-end'></span></td>";
} else if (pginp !== "") { pgl += pginp; }
if(dir=="ltr") { pgl += str; }
pgl += "</tr></tbody></table>";
if(ts.p.viewrecords===true) {$("td#"+pgid+"_"+ts.p.recordpos,"#"+pgcnt).append("<div dir='"+dir+"' style='text-align:"+ts.p.recordpos+"' class='ui-paging-info'></div>");}
$("td#"+pgid+"_"+ts.p.pagerpos,"#"+pgcnt).append(pgl);
tdw = $(".ui-jqgrid").css("font-size") || "11px";
$(document.body).append("<div id='testpg' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:"+tdw+";visibility:hidden;' ></div>");
twd = $(pgl).clone().appendTo("#testpg").width();
$("#testpg").remove();
if(twd > 0) {
if(pginp !="") { twd += 50; } //should be param
$("td#"+pgid+"_"+ts.p.pagerpos,"#"+pgcnt).width(twd);
}
ts.p._nvtd = [];
ts.p._nvtd[0] = twd ? Math.floor((ts.p.width - twd)/2) : Math.floor(ts.p.width/3);
ts.p._nvtd[1] = 0;
pgl=null;
$('.ui-pg-selbox',"#"+pgcnt).bind('change',function() {
ts.p.page = Math.round(ts.p.rowNum*(ts.p.page-1)/this.value-0.5)+1;
ts.p.rowNum = this.value;
if(tp) { $('.ui-pg-selbox',ts.p.pager).val(this.value); }
else if(ts.p.toppager) { $('.ui-pg-selbox',ts.p.toppager).val(this.value); }
if(!clearVals('records')) { return false; }
populate();
return false;
});
if(ts.p.pgbuttons===true) {
$(".ui-pg-button","#"+pgcnt).hover(function(e){
if($(this).hasClass('ui-state-disabled')) {
this.style.cursor='default';
} else {
$(this).addClass('ui-state-hover');
this.style.cursor='pointer';
}
},function(e) {
if($(this).hasClass('ui-state-disabled')) {
} else {
$(this).removeClass('ui-state-hover');
this.style.cursor= "default";
}
});
$("#first"+tp+", #prev"+tp+", #next"+tp+", #last"+tp,"#"+pgid).click( function(e) {
var cp = intNum(ts.p.page,1),
last = intNum(ts.p.lastpage,1), selclick = false,
fp=true, pp=true, np=true,lp=true;
if(last ===0 || last===1) {fp=false;pp=false;np=false;lp=false; }
else if( last>1 && cp >=1) {
if( cp === 1) { fp=false; pp=false; }
else if( cp>1 && cp <last){ }
else if( cp===last){ np=false;lp=false; }
} else if( last>1 && cp===0 ) { np=false;lp=false; cp=last-1;}
if( this.id === 'first'+tp && fp ) { ts.p.page=1; selclick=true;}
if( this.id === 'prev'+tp && pp) { ts.p.page=(cp-1); selclick=true;}
if( this.id === 'next'+tp && np) { ts.p.page=(cp+1); selclick=true;}
if( this.id === 'last'+tp && lp) { ts.p.page=last; selclick=true;}
if(selclick) {
if(!clearVals(this.id)) { return false; }
populate();
}
return false;
});
}
if(ts.p.pginput===true) {
$('input.ui-pg-input',"#"+pgcnt).keypress( function(e) {
var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;
if(key == 13) {
ts.p.page = ($(this).val()>0) ? $(this).val():ts.p.page;
if(!clearVals('user')) { return false; }
populate();
return false;
}
return this;
});
}
},
sortData = function (index, idxcol,reload,sor){
if(!ts.p.colModel[idxcol].sortable) { return; }
var so;
if(ts.p.savedRow.length > 0) {return;}
if(!reload) {
if( ts.p.lastsort == idxcol ) {
if( ts.p.sortorder == 'asc') {
ts.p.sortorder = 'desc';
} else if(ts.p.sortorder == 'desc') { ts.p.sortorder = 'asc';}
} else { ts.p.sortorder = ts.p.colModel[idxcol].firstsortorder || 'asc'; }
ts.p.page = 1;
}
if(sor) {
if(ts.p.lastsort == idxcol && ts.p.sortorder == sor && !reload) { return; }
else { ts.p.sortorder = sor; }
}
var thd= $("thead:first",ts.grid.hDiv).get(0);
$("tr th:eq("+ts.p.lastsort+") span.ui-grid-ico-sort",thd).addClass('ui-state-disabled');
$("tr th:eq("+ts.p.lastsort+")",thd).attr("aria-selected","false");
$("tr th:eq("+idxcol+") span.ui-icon-"+ts.p.sortorder,thd).removeClass('ui-state-disabled');
$("tr th:eq("+idxcol+")",thd).attr("aria-selected","true");
if(!ts.p.viewsortcols[0]) {
if(ts.p.lastsort != idxcol) {
$("tr th:eq("+ts.p.lastsort+") span.s-ico",thd).hide();
$("tr th:eq("+idxcol+") span.s-ico",thd).show();
}
}
index = index.substring(5);
ts.p.sortname = ts.p.colModel[idxcol].index || index;
so = ts.p.sortorder;
if($.isFunction(ts.p.onSortCol)) {if (ts.p.onSortCol.call(ts,index,idxcol,so)=='stop') {ts.p.lastsort = idxcol; return;}}
if(ts.p.datatype == "local") {
if(ts.p.deselectAfterSort) {$(ts).jqGrid("resetSelection");}
} else {
ts.p.selrow = null;
if(ts.p.multiselect){$("#cb_"+$.jgrid.jqID(ts.p.id),ts.grid.hDiv).attr("checked",false);}
ts.p.selarrrow =[];
ts.p.savedRow =[];
}
if(ts.p.scroll) {
var sscroll = ts.grid.bDiv.scrollLeft;
emptyRows(ts.grid.bDiv,true);
ts.grid.hDiv.scrollLeft = sscroll;
}
if(ts.p.subGrid && ts.p.datatype=='local') {
$("td.sgexpanded","#"+ts.p.id).each(function(){
$(this).trigger("click");
});
}
populate();
ts.p.lastsort = idxcol;
if(ts.p.sortname != index && idxcol) {ts.p.lastsort = idxcol;}
},
setColWidth = function () {
var initwidth = 0, brd=ts.p.cellLayout, vc=0, lvc, scw=ts.p.scrollOffset,cw,hs=false,aw,tw=0,gw=0,
cl = 0, cr;
if (isSafari) { brd=0; }
$.each(ts.p.colModel, function(i) {
if(typeof this.hidden === 'undefined') {this.hidden=false;}
if(this.hidden===false){
initwidth += intNum(this.width,0);
if(this.fixed) {
tw += this.width;
gw += this.width+brd;
} else {
vc++;
}
cl++;
}
});
if(isNaN(ts.p.width)) {ts.p.width = grid.width = initwidth;}
else { grid.width = ts.p.width;}
ts.p.tblwidth = initwidth;
if(ts.p.shrinkToFit ===false && ts.p.forceFit === true) {ts.p.forceFit=false;}
if(ts.p.shrinkToFit===true && vc > 0) {
aw = grid.width-brd*vc-gw;
if(isNaN(ts.p.height)) {
} else {
aw -= scw;
hs = true;
}
initwidth =0;
$.each(ts.p.colModel, function(i) {
if(this.hidden === false && !this.fixed){
cw = Math.round(aw*this.width/(ts.p.tblwidth-tw));
this.width =cw;
initwidth += cw;
lvc = i;
}
});
cr =0;
if (hs) {
if(grid.width-gw-(initwidth+brd*vc) !== scw){
cr = grid.width-gw-(initwidth+brd*vc)-scw;
}
} else if(!hs && Math.abs(grid.width-gw-(initwidth+brd*vc)) !== 1) {
cr = grid.width-gw-(initwidth+brd*vc);
}
ts.p.colModel[lvc].width += cr;
ts.p.tblwidth = initwidth+cr+tw+cl*brd;
if(ts.p.tblwidth > ts.p.width) {
ts.p.colModel[lvc].width -= (ts.p.tblwidth - parseInt(ts.p.width,10));
ts.p.tblwidth = ts.p.width;
}
}
},
nextVisible= function(iCol) {
var ret = iCol, j=iCol, i;
for (i = iCol+1;i<ts.p.colModel.length;i++){
if(ts.p.colModel[i].hidden !== true ) {
j=i; break;
}
}
return j-ret;
},
getOffset = function (iCol) {
var i, ret = {}, brd1 = isSafari ? 0 : ts.p.cellLayout;
ret[0] = ret[1] = ret[2] = 0;
for(i=0;i<=iCol;i++){
if(ts.p.colModel[i].hidden === false ) {
ret[0] += ts.p.colModel[i].width+brd1;
}
}
if(ts.p.direction=="rtl") { ret[0] = ts.p.width - ret[0]; }
ret[0] = ret[0] - ts.grid.bDiv.scrollLeft;
if($(ts.grid.cDiv).is(":visible")) {ret[1] += $(ts.grid.cDiv).height() +parseInt($(ts.grid.cDiv).css("padding-top"),10)+parseInt($(ts.grid.cDiv).css("padding-bottom"),10);}
if(ts.p.toolbar[0]===true && (ts.p.toolbar[1]=='top' || ts.p.toolbar[1]=='both')) {ret[1] += $(ts.grid.uDiv).height()+parseInt($(ts.grid.uDiv).css("border-top-width"),10)+parseInt($(ts.grid.uDiv).css("border-bottom-width"),10);}
if(ts.p.toppager) {ret[1] += $(ts.grid.topDiv).height()+parseInt($(ts.grid.topDiv).css("border-bottom-width"),10);}
ret[2] += $(ts.grid.bDiv).height() + $(ts.grid.hDiv).height();
return ret;
};
this.p.id = this.id;
if ($.inArray(ts.p.multikey,sortkeys) == -1 ) {ts.p.multikey = false;}
ts.p.keyIndex=false;
for (i=0; i<ts.p.colModel.length;i++) {
clm = ts.p.colModel[i];
clm = $.extend(clm, ts.p.cmTemplate, clm.template || {});
if (ts.p.keyIndex === false && ts.p.colModel[i].key===true) {
ts.p.keyIndex = i;
}
}
ts.p.sortorder = ts.p.sortorder.toLowerCase();
if(ts.p.grouping===true) {
ts.p.scroll = false;
ts.p.rownumbers = false;
ts.p.subGrid = false;
ts.p.treeGrid = false;
ts.p.gridview = true;
}
if(this.p.treeGrid === true) {
try { $(this).jqGrid("setTreeGrid");} catch (_) {}
if(ts.p.datatype != "local") { ts.p.localReader = {id: "_id_"}; }
}
if(this.p.subGrid) {
try { $(ts).jqGrid("setSubGrid");} catch (_){}
}
if(this.p.multiselect) {
this.p.colNames.unshift("<input role='checkbox' id='cb_"+this.p.id+"' class='cbox' type='checkbox'/>");
this.p.colModel.unshift({name:'cb',width:isSafari ? ts.p.multiselectWidth+ts.p.cellLayout : ts.p.multiselectWidth,sortable:false,resizable:false,hidedlg:true,search:false,align:'center',fixed:true});
}
if(this.p.rownumbers) {
this.p.colNames.unshift("");
this.p.colModel.unshift({name:'rn',width:ts.p.rownumWidth,sortable:false,resizable:false,hidedlg:true,search:false,align:'center',fixed:true});
}
ts.p.xmlReader = $.extend(true,{
root: "rows",
row: "row",
page: "rows>page",
total: "rows>total",
records : "rows>records",
repeatitems: true,
cell: "cell",
id: "[id]",
userdata: "userdata",
subgrid: {root:"rows", row: "row", repeatitems: true, cell:"cell"}
}, ts.p.xmlReader);
ts.p.jsonReader = $.extend(true,{
root: "rows",
page: "page",
total: "total",
records: "records",
repeatitems: true,
cell: "cell",
id: "id",
userdata: "userdata",
subgrid: {root:"rows", repeatitems: true, cell:"cell"}
},ts.p.jsonReader);
ts.p.localReader = $.extend(true,{
root: "rows",
page: "page",
total: "total",
records: "records",
repeatitems: false,
cell: "cell",
id: "id",
userdata: "userdata",
subgrid: {root:"rows", repeatitems: true, cell:"cell"}
},ts.p.localReader);
if(ts.p.scroll){
ts.p.pgbuttons = false; ts.p.pginput=false; ts.p.rowList=[];
}
if(ts.p.data.length) { refreshIndex(); }
var thead = "<thead><tr class='ui-jqgrid-labels' role='rowheader'>",
tdc, idn, w, res, sort,
td, ptr, tbody, imgs,iac="",idc="";
if(ts.p.shrinkToFit===true && ts.p.forceFit===true) {
for (i=ts.p.colModel.length-1;i>=0;i--){
if(!ts.p.colModel[i].hidden) {
ts.p.colModel[i].resizable=false;
break;
}
}
}
if(ts.p.viewsortcols[1] == 'horizontal') {iac=" ui-i-asc";idc=" ui-i-desc";}
tdc = isMSIE ? "class='ui-th-div-ie'" :"";
imgs = "<span class='s-ico' style='display:none'><span sort='asc' class='ui-grid-ico-sort ui-icon-asc"+iac+" ui-state-disabled ui-icon ui-icon-triangle-1-n ui-sort-"+dir+"'></span>";
imgs += "<span sort='desc' class='ui-grid-ico-sort ui-icon-desc"+idc+" ui-state-disabled ui-icon ui-icon-triangle-1-s ui-sort-"+dir+"'></span></span>";
for(i=0;i<this.p.colNames.length;i++){
var tooltip = ts.p.headertitles ? (" title=\""+$.jgrid.stripHtml(ts.p.colNames[i])+"\"") :"";
thead += "<th id='"+ts.p.id+"_"+ts.p.colModel[i].name+"' role='columnheader' class='ui-state-default ui-th-column ui-th-"+dir+"'"+ tooltip+">";
idn = ts.p.colModel[i].index || ts.p.colModel[i].name;
thead += "<div id='jqgh_"+ts.p.colModel[i].name+"' "+tdc+">"+ts.p.colNames[i];
if(!ts.p.colModel[i].width) { ts.p.colModel[i].width = 150; }
else { ts.p.colModel[i].width = parseInt(ts.p.colModel[i].width,10); }
if(typeof(ts.p.colModel[i].title) !== "boolean") { ts.p.colModel[i].title = true; }
if (idn == ts.p.sortname) {
ts.p.lastsort = i;
}
thead += imgs+"</div></th>";
}
thead += "</tr></thead>";
imgs = null;
$(this).append(thead);
$("thead tr:first th",this).hover(function(){$(this).addClass('ui-state-hover');},function(){$(this).removeClass('ui-state-hover');});
if(this.p.multiselect) {
var emp=[], chk;
$('#cb_'+$.jgrid.jqID(ts.p.id),this).bind('click',function(){
if (this.checked) {
$("[id^=jqg_"+ts.p.id+"_"+"]").attr("checked","checked");
$(ts.rows).each(function(i) {
if ( i>0 ) {
if(!$(this).hasClass("subgrid") && !$(this).hasClass("jqgroup")){
$(this).addClass("ui-state-highlight").attr("aria-selected","true");
ts.p.selarrrow.push(this.id);
ts.p.selrow = this.id;
}
}
});
chk=true;
emp=[];
}
else {
$("[id^=jqg_"+ts.p.id+"_"+"]").removeAttr("checked");
$(ts.rows).each(function(i) {
if(i>0) {
if(!$(this).hasClass("subgrid")){
$(this).removeClass("ui-state-highlight").attr("aria-selected","false");
emp.push(this.id);
}
}
});
ts.p.selarrrow = []; ts.p.selrow = null;
chk=false;
}
if($.isFunction(ts.p.onSelectAll)) {ts.p.onSelectAll.call(ts, chk ? ts.p.selarrrow : emp,chk);}
});
}
if(ts.p.autowidth===true) {
var pw = $(eg).innerWidth();
ts.p.width = pw > 0? pw: 'nw';
}
setColWidth();
$(eg).css("width",grid.width+"px").append("<div class='ui-jqgrid-resize-mark' id='rs_m"+ts.p.id+"'> </div>");
$(gv).css("width",grid.width+"px");
thead = $("thead:first",ts).get(0);
var tfoot = "";
if(ts.p.footerrow) { tfoot += "<table role='grid' style='width:"+ts.p.tblwidth+"px' class='ui-jqgrid-ftable' cellspacing='0' cellpadding='0' border='0'><tbody><tr role='row' class='ui-widget-content footrow footrow-"+dir+"'>"; }
var thr = $("tr:first",thead),
firstr = "<tr class='jqgfirstrow' role='row' style='height:auto'>";
ts.p.disableClick=false;
$("th",thr).each(function ( j ) {
w = ts.p.colModel[j].width;
if(typeof ts.p.colModel[j].resizable === 'undefined') {ts.p.colModel[j].resizable = true;}
if(ts.p.colModel[j].resizable){
res = document.createElement("span");
$(res).html(" ").addClass('ui-jqgrid-resize ui-jqgrid-resize-'+dir);
if(!$.browser.opera) { $(res).css("cursor","col-resize"); }
$(this).addClass(ts.p.resizeclass);
} else {
res = "";
}
$(this).css("width",w+"px").prepend(res);
var hdcol = "";
if( ts.p.colModel[j].hidden ) {
$(this).css("display","none");
hdcol = "display:none;";
}
firstr += "<td role='gridcell' style='height:0px;width:"+w+"px;"+hdcol+"'></td>";
grid.headers[j] = { width: w, el: this };
sort = ts.p.colModel[j].sortable;
if( typeof sort !== 'boolean') {ts.p.colModel[j].sortable = true; sort=true;}
var nm = ts.p.colModel[j].name;
if( !(nm == 'cb' || nm=='subgrid' || nm=='rn') ) {
if(ts.p.viewsortcols[2]){
$("div",this).addClass('ui-jqgrid-sortable');
}
}
if(sort) {
if(ts.p.viewsortcols[0]) {$("div span.s-ico",this).show(); if(j==ts.p.lastsort){ $("div span.ui-icon-"+ts.p.sortorder,this).removeClass("ui-state-disabled");}}
else if( j == ts.p.lastsort) {$("div span.s-ico",this).show();$("div span.ui-icon-"+ts.p.sortorder,this).removeClass("ui-state-disabled");}
}
if(ts.p.footerrow) { tfoot += "<td role='gridcell' "+formatCol(j,0,'')+"> </td>"; }
}).mousedown(function(e) {
if ($(e.target).closest("th>span.ui-jqgrid-resize").length != 1) { return; }
var ci = $.jgrid.getCellIndex(this);
if(ts.p.forceFit===true) {ts.p.nv= nextVisible(ci);}
grid.dragStart(ci, e, getOffset(ci));
return false;
}).click(function(e) {
if (ts.p.disableClick) {
ts.p.disableClick = false;
return false;
}
var s = "th>div.ui-jqgrid-sortable",r,d;
if (!ts.p.viewsortcols[2]) { s = "th>div>span>span.ui-grid-ico-sort"; }
var t = $(e.target).closest(s);
if (t.length != 1) { return; }
var ci = $.jgrid.getCellIndex(this);
if (!ts.p.viewsortcols[2]) { r=true;d=t.attr("sort"); }
sortData($('div',this)[0].id,ci,r,d);
return false;
});
if (ts.p.sortable && $.fn.sortable) {
try {
$(ts).jqGrid("sortableColumns", thr);
} catch (e){}
}
if(ts.p.footerrow) { tfoot += "</tr></tbody></table>"; }
firstr += "</tr>";
tbody = document.createElement("tbody");
this.appendChild(tbody);
$(this).addClass('ui-jqgrid-btable').append(firstr);
firstr = null;
var hTable = $("<table class='ui-jqgrid-htable' style='width:"+ts.p.tblwidth+"px' role='grid' aria-labelledby='gbox_"+this.id+"' cellspacing='0' cellpadding='0' border='0'></table>").append(thead),
hg = (ts.p.caption && ts.p.hiddengrid===true) ? true : false,
hb = $("<div class='ui-jqgrid-hbox" + (dir=="rtl" ? "-rtl" : "" )+"'></div>");
thead = null;
grid.hDiv = document.createElement("div");
$(grid.hDiv)
.css({ width: grid.width+"px"})
.addClass("ui-state-default ui-jqgrid-hdiv")
.append(hb);
$(hb).append(hTable);
hTable = null;
if(hg) { $(grid.hDiv).hide(); }
if(ts.p.pager){
if(typeof ts.p.pager == "string") {if(ts.p.pager.substr(0,1) !="#") { ts.p.pager = "#"+ts.p.pager;} }
else { ts.p.pager = "#"+ $(ts.p.pager).attr("id");}
$(ts.p.pager).css({width: grid.width+"px"}).appendTo(eg).addClass('ui-state-default ui-jqgrid-pager ui-corner-bottom');
if(hg) {$(ts.p.pager).hide();}
setPager(ts.p.pager,'');
}
if( ts.p.cellEdit === false && ts.p.hoverrows === true) {
$(ts).bind('mouseover',function(e) {
ptr = $(e.target).closest("tr.jqgrow");
if($(ptr).attr("class") !== "subgrid") {
$(ptr).addClass("ui-state-hover");
}
return false;
}).bind('mouseout',function(e) {
ptr = $(e.target).closest("tr.jqgrow");
$(ptr).removeClass("ui-state-hover");
return false;
});
}
var ri,ci;
$(ts).before(grid.hDiv).click(function(e) {
td = e.target;
var scb = $(td).hasClass("cbox");
ptr = $(td,ts.rows).closest("tr.jqgrow");
if($(ptr).length === 0 ) {
return this;
}
var cSel = true;
if($.isFunction(ts.p.beforeSelectRow)) { cSel = ts.p.beforeSelectRow.call(ts,ptr[0].id, e); }
if (td.tagName == 'A' || ((td.tagName == 'INPUT' || td.tagName == 'TEXTAREA' || td.tagName == 'OPTION' || td.tagName == 'SELECT' ) && !scb) ) { return this; }
if(cSel === true) {
if(ts.p.cellEdit === true) {
if(ts.p.multiselect && scb){
$(ts).jqGrid("setSelection",ptr[0].id,true);
} else {
ri = ptr[0].rowIndex;
ci = $.jgrid.getCellIndex(td);
try {$(ts).jqGrid("editCell",ri,ci,true);} catch (_) {}
}
} else if ( !ts.p.multikey ) {
if(ts.p.multiselect && ts.p.multiboxonly) {
if(scb){$(ts).jqGrid("setSelection",ptr[0].id,true);}
else {
$(ts.p.selarrrow).each(function(i,n){
var ind = ts.rows.namedItem(n);
$(ind).removeClass("ui-state-highlight");
$("#jqg_"+ts.p.id+"_"+$.jgrid.jqID(n)).attr("checked",false);
});
ts.p.selarrrow = [];
$("#cb_"+$.jgrid.jqID(ts.p.id),ts.grid.hDiv).attr("checked",false);
$(ts).jqGrid("setSelection",ptr[0].id,true);
}
} else {
$(ts).jqGrid("setSelection",ptr[0].id,true);
}
} else {
if(e[ts.p.multikey]) {
$(ts).jqGrid("setSelection",ptr[0].id,true);
} else if(ts.p.multiselect && scb) {
scb = $("[id^=jqg_"+ts.p.id+"_"+"]").attr("checked");
$("[id^=jqg_"+ts.p.id+"_"+"]").attr("checked",!scb);
}
}
if($.isFunction(ts.p.onCellSelect)) {
ri = ptr[0].id;
ci = $.jgrid.getCellIndex(td);
ts.p.onCellSelect.call(ts,ri,ci,$(td).html(),e);
}
e.stopPropagation();
} else {
return this;
}
}).bind('reloadGrid', function(e,opts) {
if(ts.p.treeGrid ===true) { ts.p.datatype = ts.p.treedatatype;}
if (opts && opts.current) {
ts.grid.selectionPreserver(ts);
}
if(ts.p.datatype=="local"){ $(ts).jqGrid("resetSelection"); if(ts.p.data.length) { refreshIndex();} }
else if(!ts.p.treeGrid) {
ts.p.selrow=null;
if(ts.p.multiselect) {ts.p.selarrrow =[];$('#cb_'+$.jgrid.jqID(ts.p.id),ts.grid.hDiv).attr("checked",false);}
ts.p.savedRow = [];
}
if(ts.p.scroll) {emptyRows(ts.grid.bDiv,true);}
if (opts && opts.page) {
var page = opts.page;
if (page > ts.p.lastpage) { page = ts.p.lastpage; }
if (page < 1) { page = 1; }
ts.p.page = page;
if (ts.grid.prevRowHeight) {
ts.grid.bDiv.scrollTop = (page - 1) * ts.grid.prevRowHeight * ts.p.rowNum;
} else {
ts.grid.bDiv.scrollTop = 0;
}
}
if (ts.grid.prevRowHeight && ts.p.scroll) {
delete ts.p.lastpage;
ts.grid.populateVisible();
} else {
ts.grid.populate();
}
return false;
});
if( $.isFunction(this.p.ondblClickRow) ) {
$(this).dblclick(function(e) {
td = e.target;
ptr = $(td,ts.rows).closest("tr.jqgrow");
if($(ptr).length === 0 ){return false;}
ri = ptr[0].rowIndex;
ci = $.jgrid.getCellIndex(td);
ts.p.ondblClickRow.call(ts,$(ptr).attr("id"),ri,ci, e);
return false;
});
}
if ($.isFunction(this.p.onRightClickRow)) {
$(this).bind('contextmenu', function(e) {
td = e.target;
ptr = $(td,ts.rows).closest("tr.jqgrow");
if($(ptr).length === 0 ){return false;}
if(!ts.p.multiselect) { $(ts).jqGrid("setSelection",ptr[0].id,true); }
ri = ptr[0].rowIndex;
ci = $.jgrid.getCellIndex(td);
ts.p.onRightClickRow.call(ts,$(ptr).attr("id"),ri,ci, e);
return false;
});
}
grid.bDiv = document.createElement("div");
$(grid.bDiv)
.append($('<div style="position:relative;'+(isMSIE && $.browser.version < 8 ? "height:0.01%;" : "")+'"></div>').append('<div></div>').append(this))
.addClass("ui-jqgrid-bdiv")
.css({ height: ts.p.height+(isNaN(ts.p.height)?"":"px"), width: (grid.width)+"px"})
.scroll(grid.scrollGrid);
$("table:first",grid.bDiv).css({width:ts.p.tblwidth+"px"});
if( isMSIE ) {
if( $("tbody",this).size() == 2 ) { $("tbody:gt(0)",this).remove();}
if( ts.p.multikey) {$(grid.bDiv).bind("selectstart",function(){return false;});}
} else {
if( ts.p.multikey) {$(grid.bDiv).bind("mousedown",function(){return false;});}
}
if(hg) {$(grid.bDiv).hide();}
grid.cDiv = document.createElement("div");
var arf = ts.p.hidegrid===true ? $("<a role='link' href='javascript:void(0)'/>").addClass('ui-jqgrid-titlebar-close HeaderButton').hover(
function(){ arf.addClass('ui-state-hover');},
function() {arf.removeClass('ui-state-hover');})
.append("<span class='ui-icon ui-icon-circle-triangle-n'></span>").css((dir=="rtl"?"left":"right"),"0px") : "";
$(grid.cDiv).append(arf).append("<span class='ui-jqgrid-title"+(dir=="rtl" ? "-rtl" :"" )+"'>"+ts.p.caption+"</span>")
.addClass("ui-jqgrid-titlebar ui-widget-header ui-corner-top ui-helper-clearfix");
$(grid.cDiv).insertBefore(grid.hDiv);
if( ts.p.toolbar[0] ) {
grid.uDiv = document.createElement("div");
if(ts.p.toolbar[1] == "top") {$(grid.uDiv).insertBefore(grid.hDiv);}
else if (ts.p.toolbar[1]=="bottom" ) {$(grid.uDiv).insertAfter(grid.hDiv);}
if(ts.p.toolbar[1]=="both") {
grid.ubDiv = document.createElement("div");
$(grid.uDiv).insertBefore(grid.hDiv).addClass("ui-userdata ui-state-default").attr("id","t_"+this.id);
$(grid.ubDiv).insertAfter(grid.hDiv).addClass("ui-userdata ui-state-default").attr("id","tb_"+this.id);
if(hg) {$(grid.ubDiv).hide();}
} else {
$(grid.uDiv).width(grid.width).addClass("ui-userdata ui-state-default").attr("id","t_"+this.id);
}
if(hg) {$(grid.uDiv).hide();}
}
if(ts.p.toppager) {
ts.p.toppager = ts.p.id+"_toppager";
grid.topDiv = $("<div id='"+ts.p.toppager+"'></div>")[0];
ts.p.toppager = "#"+ts.p.toppager;
$(grid.topDiv).insertBefore(grid.hDiv).addClass('ui-state-default ui-jqgrid-toppager').width(grid.width);
setPager(ts.p.toppager,'_t');
}
if(ts.p.footerrow) {
grid.sDiv = $("<div class='ui-jqgrid-sdiv'></div>")[0];
hb = $("<div class='ui-jqgrid-hbox"+(dir=="rtl"?"-rtl":"")+"'></div>");
$(grid.sDiv).append(hb).insertAfter(grid.hDiv).width(grid.width);
$(hb).append(tfoot);
grid.footers = $(".ui-jqgrid-ftable",grid.sDiv)[0].rows[0].cells;
if(ts.p.rownumbers) { grid.footers[0].className = 'ui-state-default jqgrid-rownum'; }
if(hg) {$(grid.sDiv).hide();}
}
hb = null;
if(ts.p.caption) {
var tdt = ts.p.datatype;
if(ts.p.hidegrid===true) {
$(".ui-jqgrid-titlebar-close",grid.cDiv).click( function(e){
var onHdCl = $.isFunction(ts.p.onHeaderClick),
elems = ".ui-jqgrid-bdiv, .ui-jqgrid-hdiv, .ui-jqgrid-pager, .ui-jqgrid-sdiv",
counter, self = this;
if(ts.p.toolbar[0]===true) {
if( ts.p.toolbar[1]=='both') {
elems += ', #' + $(grid.ubDiv).attr('id');
}
elems += ', #' + $(grid.uDiv).attr('id');
}
counter = $(elems,"#gview_"+ts.p.id).length;
if(ts.p.gridstate == 'visible') {
$(elems,"#gbox_"+ts.p.id).slideUp("fast", function() {
counter--;
if (counter == 0) {
$("span",self).removeClass("ui-icon-circle-triangle-n").addClass("ui-icon-circle-triangle-s");
ts.p.gridstate = 'hidden';
if($("#gbox_"+ts.p.id).hasClass("ui-resizable")) { $(".ui-resizable-handle","#gbox_"+ts.p.id).hide(); }
if(onHdCl) {if(!hg) {ts.p.onHeaderClick.call(ts,ts.p.gridstate,e);}}
}
});
} else if(ts.p.gridstate == 'hidden'){
$(elems,"#gbox_"+ts.p.id).slideDown("fast", function() {
counter--;
if (counter == 0) {
$("span",self).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n");
if(hg) {ts.p.datatype = tdt;populate();hg=false;}
ts.p.gridstate = 'visible';
if($("#gbox_"+ts.p.id).hasClass("ui-resizable")) { $(".ui-resizable-handle","#gbox_"+ts.p.id).show(); }
if(onHdCl) {if(!hg) {ts.p.onHeaderClick.call(ts,ts.p.gridstate,e);}}
}
});
}
return false;
});
if(hg) {ts.p.datatype="local"; $(".ui-jqgrid-titlebar-close",grid.cDiv).trigger("click");}
}
} else {$(grid.cDiv).hide();}
$(grid.hDiv).after(grid.bDiv)
.mousemove(function (e) {
if(grid.resizing){grid.dragMove(e);return false;}
});
$(".ui-jqgrid-labels",grid.hDiv).bind("selectstart", function () { return false; });
$(document).mouseup(function (e) {
if(grid.resizing) { grid.dragEnd(); return false;}
return true;
});
ts.formatCol = formatCol;
ts.sortData = sortData;
ts.updatepager = updatepager;
ts.refreshIndex = refreshIndex;
ts.formatter = function ( rowId, cellval , colpos, rwdat, act){return formatter(rowId, cellval , colpos, rwdat, act);};
$.extend(grid,{populate : populate, emptyRows: emptyRows});
this.grid = grid;
ts.addXmlData = function(d) {addXmlData(d,ts.grid.bDiv);};
ts.addJSONData = function(d) {addJSONData(d,ts.grid.bDiv);};
this.grid.cols = this.rows[0].cells;
populate();ts.p.hiddengrid=false;
$(window).unload(function () {
ts = null;
});
});
};
$.jgrid.extend({
getGridParam : function(pName) {
var $t = this[0];
if (!$t || !$t.grid) {return;}
if (!pName) { return $t.p; }
else {return typeof($t.p[pName]) != "undefined" ? $t.p[pName] : null;}
},
setGridParam : function (newParams){
return this.each(function(){
if (this.grid && typeof(newParams) === 'object') {$.extend(true,this.p,newParams);}
});
},
getDataIDs : function () {
var ids=[], i=0, len, j=0;
this.each(function(){
len = this.rows.length;
if(len && len>0){
while(i<len) {
if($(this.rows[i]).hasClass('jqgrow')) {
ids[j] = this.rows[i].id;
j++;
}
i++;
}
}
});
return ids;
},
setSelection : function(selection,onsr) {
return this.each(function(){
var $t = this, stat,pt, ner, ia, tpsr;
if(selection === undefined) { return; }
onsr = onsr === false ? false : true;
pt=$t.rows.namedItem(selection+"");
if(!pt) { return; }
function scrGrid(iR){
var ch = $($t.grid.bDiv)[0].clientHeight,
st = $($t.grid.bDiv)[0].scrollTop,
rpos = $t.rows[iR].offsetTop,
rh = $t.rows[iR].clientHeight;
if(rpos+rh >= ch+st) { $($t.grid.bDiv)[0].scrollTop = rpos-(ch+st)+rh+st; }
else if(rpos < ch+st) {
if(rpos < st) {
$($t.grid.bDiv)[0].scrollTop = rpos;
}
}
}
if($t.p.scrollrows===true) {
ner = $t.rows.namedItem(selection).rowIndex;
if(ner >=0 ){
scrGrid(ner);
}
}
if(!$t.p.multiselect) {
if(pt.className !== "ui-subgrid") {
if( $t.p.selrow ) {
$($t.rows.namedItem($t.p.selrow)).removeClass("ui-state-highlight").attr("aria-selected","false");
}
if( $t.p.selrow != pt.id) {
$t.p.selrow = pt.id;
$(pt).addClass("ui-state-highlight").attr("aria-selected","true");
if( $t.p.onSelectRow && onsr) { $t.p.onSelectRow.call($t,$t.p.selrow, true); }
} else {$t.p.selrow = null;}
}
} else {
$t.p.selrow = pt.id;
ia = $.inArray($t.p.selrow,$t.p.selarrrow);
if ( ia === -1 ){
if(pt.className !== "ui-subgrid") { $(pt).addClass("ui-state-highlight").attr("aria-selected","true");}
stat = true;
$("#jqg_"+$t.p.id+"_"+$.jgrid.jqID($t.p.selrow)).attr("checked",stat);
$t.p.selarrrow.push($t.p.selrow);
if( $t.p.onSelectRow && onsr) { $t.p.onSelectRow.call($t,$t.p.selrow, stat); }
} else {
if(pt.className !== "ui-subgrid") { $(pt).removeClass("ui-state-highlight").attr("aria-selected","false");}
stat = false;
$("#jqg_"+$t.p.id+"_"+$.jgrid.jqID($t.p.selrow)).attr("checked",stat);
$t.p.selarrrow.splice(ia,1);
if( $t.p.onSelectRow && onsr) { $t.p.onSelectRow.call($t,$t.p.selrow, stat); }
tpsr = $t.p.selarrrow[0];
$t.p.selrow = (tpsr === undefined) ? null : tpsr;
}
}
});
},
resetSelection : function(){
return this.each(function(){
var t = this, ind;
if(!t.p.multiselect) {
if(t.p.selrow) {
$("#"+t.p.id+" tbody:first tr#"+$.jgrid.jqID(t.p.selrow)).removeClass("ui-state-highlight").attr("aria-selected","false");
t.p.selrow = null;
}
} else {
$(t.p.selarrrow).each(function(i,n){
ind = t.rows.namedItem(n);
$(ind).removeClass("ui-state-highlight").attr("aria-selected","false");
$("#jqg_"+t.p.id+"_"+$.jgrid.jqID(n)).attr("checked",false);
});
$("#cb_"+$.jgrid.jqID(t.p.id)).attr("checked",false);
t.p.selarrrow = [];
}
t.p.savedRow = [];
});
},
getRowData : function( rowid ) {
var res = {}, resall, getall=false, len, j=0;
this.each(function(){
var $t = this,nm,ind;
if(typeof(rowid) == 'undefined') {
getall = true;
resall = [];
len = $t.rows.length;
} else {
ind = $t.rows.namedItem(rowid);
if(!ind) { return res; }
len = 2;
}
while(j<len){
if(getall) { ind = $t.rows[j]; }
if( $(ind).hasClass('jqgrow') ) {
$('td',ind).each( function(i) {
nm = $t.p.colModel[i].name;
if ( nm !== 'cb' && nm !== 'subgrid' && nm !== 'rn') {
if($t.p.treeGrid===true && nm == $t.p.ExpandColumn) {
res[nm] = $.jgrid.htmlDecode($("span:first",this).html());
} else {
try {
res[nm] = $.unformat(this,{rowId:ind.id, colModel:$t.p.colModel[i]},i);
} catch (e){
res[nm] = $.jgrid.htmlDecode($(this).html());
}
}
}
});
if(getall) { resall.push(res); res={}; }
}
j++;
}
});
return resall ? resall: res;
},
delRowData : function(rowid) {
var success = false, rowInd, ia, ri;
this.each(function() {
var $t = this;
rowInd = $t.rows.namedItem(rowid);
if(!rowInd) {return false;}
else {
ri = rowInd.rowIndex;
$(rowInd).remove();
$t.p.records--;
$t.p.reccount--;
$t.updatepager(true,false);
success=true;
if($t.p.multiselect) {
ia = $.inArray(rowid,$t.p.selarrrow);
if(ia != -1) { $t.p.selarrrow.splice(ia,1);}
}
if(rowid == $t.p.selrow) {$t.p.selrow=null;}
}
if($t.p.datatype == 'local') {
var pos = $t.p._index[rowid];
if(typeof(pos) != 'undefined') {
$t.p.data.splice(pos,1);
$t.refreshIndex();
}
}
if( $t.p.altRows === true && success ) {
var cn = $t.p.altclass;
$($t.rows).each(function(i){
if(i % 2 ==1) { $(this).addClass(cn); }
else { $(this).removeClass(cn); }
});
}
});
return success;
},
setRowData : function(rowid, data, cssp) {
var nm, success=true, title;
this.each(function(){
if(!this.grid) {return false;}
var t = this, vl, ind, cp = typeof cssp, lcdata={};
ind = t.rows.namedItem(rowid);
if(!ind) { return false; }
if( data ) {
try {
$(this.p.colModel).each(function(i){
nm = this.name;
if( data[nm] !== undefined) {
lcdata[nm] = this.formatter && typeof(this.formatter) === 'string' && this.formatter == 'date' ? $.unformat.date(data[nm],this) : data[nm];
vl = t.formatter( rowid, data[nm], i, data, 'edit');
title = this.title ? {"title":$.jgrid.stripHtml(vl)} : {};
if(t.p.treeGrid===true && nm == t.p.ExpandColumn) {
$("td:eq("+i+") > span:first",ind).html(vl).attr(title);
} else {
$("td:eq("+i+")",ind).html(vl).attr(title);
}
}
});
if(t.p.datatype == 'local') {
var pos = t.p._index[rowid];
if(typeof(pos) != 'undefined') {
t.p.data[pos] = $.extend(true, t.p.data[pos], lcdata);
}
lcdata = null;
}
} catch (e) {
success = false;
}
}
if(success) {
if(cp === 'string') {$(ind).addClass(cssp);} else if(cp === 'object') {$(ind).css(cssp);}
}
});
return success;
},
addRowData : function(rowid,rdata,pos,src) {
if(!pos) {pos = "last";}
var success = false, nm, row, gi, si, ni,sind, i, v, prp="", aradd, cnm, cn, data, cm;
if(rdata) {
if($.isArray(rdata)) {
aradd=true;
pos = "last";
cnm = rowid;
} else {
rdata = [rdata];
aradd = false;
}
this.each(function() {
var t = this, datalen = rdata.length;
ni = t.p.rownumbers===true ? 1 :0;
gi = t.p.multiselect ===true ? 1 :0;
si = t.p.subGrid===true ? 1 :0;
if(!aradd) {
if(typeof(rowid) != 'undefined') { rowid = rowid+"";}
else {
rowid = (t.p.records+1)+"";
if(t.p.keyIndex !== false) {
cnm = t.p.colModel[t.p.keyIndex+gi+si+ni].name;
if(typeof rdata[0][cnm] != "undefined") { rowid = rdata[0][cnm]; }
}
}
}
cn = t.p.altclass;
var k = 0, cna ="", lcdata = {},
air = $.isFunction(t.p.afterInsertRow) ? true : false;
while(k < datalen) {
data = rdata[k];
row="";
if(aradd) {
try {rowid = data[cnm];}
catch (e) {rowid = (t.p.records+1)+"";}
cna = t.p.altRows === true ? (t.rows.length-1)%2 === 0 ? cn : "" : "";
}
if(ni){
prp = t.formatCol(0,1,'');
row += "<td role=\"gridcell\" aria-describedby=\""+t.p.id+"_rn\" class=\"ui-state-default jqgrid-rownum\" "+prp+">0</td>";
}
if(gi) {
v = "<input role=\"checkbox\" type=\"checkbox\""+" id=\"jqg_"+t.p.id+"_"+rowid+"\" class=\"cbox\"/>";
prp = t.formatCol(ni,1,'');
row += "<td role=\"gridcell\" aria-describedby=\""+t.p.id+"_cb\" "+prp+">"+v+"</td>";
}
if(si) {
row += $(t).jqGrid("addSubGridCell",gi+ni,1);
}
for(i = gi+si+ni; i < t.p.colModel.length;i++){
cm = t.p.colModel[i];
nm = cm.name;
lcdata[nm] = cm.formatter && typeof(cm.formatter) === 'string' && cm.formatter == 'date' ? $.unformat.date(data[nm],cm) : data[nm];
v = t.formatter( rowid, $.jgrid.getAccessor(data,nm), i, data, 'edit');
prp = t.formatCol(i,1,v);
row += "<td role=\"gridcell\" aria-describedby=\""+t.p.id+"_"+nm+"\" "+prp+">"+v+"</td>";
}
row = "<tr id=\""+rowid+"\" role=\"row\" class=\"ui-widget-content jqgrow ui-row-"+t.p.direction+" "+cna+"\">" + row+"</tr>";
if(t.p.subGrid===true) {
row = $(row)[0];
$(t).jqGrid("addSubGrid",row,gi+ni);
}
if(t.rows.length === 0){
$("table:first",t.grid.bDiv).append(row);
} else {
switch (pos) {
case 'last':
$(t.rows[t.rows.length-1]).after(row);
break;
case 'first':
$(t.rows[0]).after(row);
break;
case 'after':
sind = t.rows.namedItem(src);
if (sind) {
if($(t.rows[sind.rowIndex+1]).hasClass("ui-subgrid")) { $(t.rows[sind.rowIndex+1]).after(row); }
else { $(sind).after(row); }
}
break;
case 'before':
sind = t.rows.namedItem(src);
if(sind) {$(sind).before(row);sind=sind.rowIndex;}
break;
}
}
t.p.records++;
t.p.reccount++;
if(air) { t.p.afterInsertRow.call(t,rowid,data,data); }
k++;
if(t.p.datatype == 'local') {
t.p._index[rowid] = t.p.data.length;
t.p.data.push(lcdata);
lcdata = {};
}
}
if( t.p.altRows === true && !aradd) {
if (pos == "last") {
if ((t.rows.length-1)%2 == 1) {$(t.rows[t.rows.length-1]).addClass(cn);}
} else {
$(t.rows).each(function(i){
if(i % 2 ==1) { $(this).addClass(cn); }
else { $(this).removeClass(cn); }
});
}
}
t.updatepager(true,true);
success = true;
});
}
return success;
},
footerData : function(action,data, format) {
var nm, success=false, res={}, title;
function isEmpty(obj) {
for(var i in obj) {
if (obj.hasOwnProperty(i)) { return false; }
}
return true;
}
if(typeof(action) == "undefined") { action = "get"; }
if(typeof(format) != "boolean") { format = true; }
action = action.toLowerCase();
this.each(function(){
var t = this, vl;
if(!t.grid || !t.p.footerrow) {return false;}
if(action == "set") { if(isEmpty(data)) { return false; } }
success=true;
$(this.p.colModel).each(function(i){
nm = this.name;
if(action == "set") {
if( data[nm] !== undefined) {
vl = format ? t.formatter( "", data[nm], i, data, 'edit') : data[nm];
title = this.title ? {"title":$.jgrid.stripHtml(vl)} : {};
$("tr.footrow td:eq("+i+")",t.grid.sDiv).html(vl).attr(title);
success = true;
}
} else if(action == "get") {
res[nm] = $("tr.footrow td:eq("+i+")",t.grid.sDiv).html();
}
});
});
return action == "get" ? res : success;
},
ShowHideCol : function(colname,show) {
return this.each(function() {
var $t = this, fndh=false;
if (!$t.grid ) {return;}
if( typeof colname === 'string') {colname=[colname];}
show = show != "none" ? "" : "none";
var sw = show === "" ? true :false;
$(this.p.colModel).each(function(i) {
if ($.inArray(this.name,colname) !== -1 && this.hidden === sw) {
$("tr",$t.grid.hDiv).each(function(){
$("th:eq("+i+")",this).css("display",show);
});
$($t.rows).each(function(j){
$("td:eq("+i+")",$t.rows[j]).css("display",show);
});
if($t.p.footerrow) { $("td:eq("+i+")",$t.grid.sDiv).css("display", show); }
if(show == "none") { $t.p.tblwidth -= this.width+$t.p.cellLayout;} else {$t.p.tblwidth += this.width;}
this.hidden = !sw;
fndh=true;
}
});
if(fndh===true) {
$("table:first",$t.grid.hDiv).width($t.p.tblwidth);
$("table:first",$t.grid.bDiv).width($t.p.tblwidth);
$t.grid.hDiv.scrollLeft = $t.grid.bDiv.scrollLeft;
if($t.p.footerrow) {
$("table:first",$t.grid.sDiv).width($t.p.tblwidth);
$t.grid.sDiv.scrollLeft = $t.grid.bDiv.scrollLeft;
}
if($t.p.shrinkToFit===true) {
$($t).jqGrid("setGridWidth",$t.grid.width-0.001,true);
}
}
});
},
hideCol : function (colname) {
return this.each(function(){$(this).jqGrid("ShowHideCol",colname,"none");});
},
showCol : function(colname) {
return this.each(function(){$(this).jqGrid("ShowHideCol",colname,"");});
},
remapColumns : function(permutation, updateCells, keepHeader)
{
function resortArray(a) {
var ac;
if (a.length) {
ac = $.makeArray(a);
} else {
ac = $.extend({}, a);
}
$.each(permutation, function(i) {
a[i] = ac[this];
});
}
var ts = this.get(0);
function resortRows(parent, clobj) {
$(">tr"+(clobj||""), parent).each(function() {
var row = this;
var elems = $.makeArray(row.cells);
$.each(permutation, function() {
var e = elems[this];
if (e) {
row.appendChild(e);
}
});
});
}
resortArray(ts.p.colModel);
resortArray(ts.p.colNames);
resortArray(ts.grid.headers);
resortRows($("thead:first", ts.grid.hDiv), keepHeader && ":not(.ui-jqgrid-labels)");
if (updateCells) {
resortRows($("#"+ts.p.id+" tbody:first"), ".jqgfirstrow, tr.jqgrow, tr.jqfoot");
}
if (ts.p.footerrow) {
resortRows($("tbody:first", ts.grid.sDiv));
}
if (ts.p.remapColumns) {
if (!ts.p.remapColumns.length){
ts.p.remapColumns = $.makeArray(permutation);
} else {
resortArray(ts.p.remapColumns);
}
}
ts.p.lastsort = $.inArray(ts.p.lastsort, permutation);
if(ts.p.treeGrid) { ts.p.expColInd = $.inArray(ts.p.expColInd, permutation); }
},
setGridWidth : function(nwidth, shrink) {
return this.each(function(){
if (!this.grid ) {return;}
var $t = this, cw,
initwidth = 0, brd=$t.p.cellLayout, lvc, vc=0, hs=false, scw=$t.p.scrollOffset, aw, gw=0, tw=0,
cl = 0,cr;
if(typeof shrink != 'boolean') {
shrink=$t.p.shrinkToFit;
}
if(isNaN(nwidth)) {return;}
else { nwidth = parseInt(nwidth,10); $t.grid.width = $t.p.width = nwidth;}
$("#gbox_"+$t.p.id).css("width",nwidth+"px");
$("#gview_"+$t.p.id).css("width",nwidth+"px");
$($t.grid.bDiv).css("width",nwidth+"px");
$($t.grid.hDiv).css("width",nwidth+"px");
if($t.p.pager ) {$($t.p.pager).css("width",nwidth+"px");}
if($t.p.toppager ) {$($t.p.toppager).css("width",nwidth+"px");}
if($t.p.toolbar[0] === true){
$($t.grid.uDiv).css("width",nwidth+"px");
if($t.p.toolbar[1]=="both") {$($t.grid.ubDiv).css("width",nwidth+"px");}
}
if($t.p.footerrow) { $($t.grid.sDiv).css("width",nwidth+"px"); }
if(shrink ===false && $t.p.forceFit === true) {$t.p.forceFit=false;}
if(shrink===true) {
if ($.browser.safari) { brd=0;}
$.each($t.p.colModel, function(i) {
if(this.hidden===false){
initwidth += parseInt(this.width,10);
if(this.fixed) {
tw += this.width;
gw += this.width+brd;
} else {
vc++;
}
cl++;
}
});
if(vc === 0) { return; }
$t.p.tblwidth = initwidth;
aw = nwidth-brd*vc-gw;
if(!isNaN($t.p.height)) {
if($($t.grid.bDiv)[0].clientHeight < $($t.grid.bDiv)[0].scrollHeight || $t.rows.length === 1){
hs = true;
aw -= scw;
}
}
initwidth =0;
var cle = $t.grid.cols.length >0;
$.each($t.p.colModel, function(i) {
if(this.hidden === false && !this.fixed){
cw = Math.round(aw*this.width/($t.p.tblwidth-tw));
if (cw < 0) { return; }
this.width =cw;
initwidth += cw;
$t.grid.headers[i].width=cw;
$t.grid.headers[i].el.style.width=cw+"px";
if($t.p.footerrow) { $t.grid.footers[i].style.width = cw+"px"; }
if(cle) { $t.grid.cols[i].style.width = cw+"px"; }
lvc = i;
}
});
cr =0;
if (hs) {
if(nwidth-gw-(initwidth+brd*vc) !== scw){
cr = nwidth-gw-(initwidth+brd*vc)-scw;
}
} else if( Math.abs(nwidth-gw-(initwidth+brd*vc)) !== 1) {
cr = nwidth-gw-(initwidth+brd*vc);
}
$t.p.colModel[lvc].width += cr;
$t.p.tblwidth = initwidth+cr+tw+brd*cl;
if($t.p.tblwidth > nwidth) {
var delta = $t.p.tblwidth - parseInt(nwidth,10);
$t.p.tblwidth = nwidth;
cw = $t.p.colModel[lvc].width = $t.p.colModel[lvc].width-delta;
} else {
cw= $t.p.colModel[lvc].width;
}
$t.grid.headers[lvc].width = cw;
$t.grid.headers[lvc].el.style.width=cw+"px";
if(cle) { $t.grid.cols[lvc].style.width = cw+"px"; }
$('table:first',$t.grid.bDiv).css("width",$t.p.tblwidth+"px");
$('table:first',$t.grid.hDiv).css("width",$t.p.tblwidth+"px");
$t.grid.hDiv.scrollLeft = $t.grid.bDiv.scrollLeft;
if($t.p.footerrow) {
$t.grid.footers[lvc].style.width = cw+"px";
$('table:first',$t.grid.sDiv).css("width",$t.p.tblwidth+"px");
}
}
});
},
setGridHeight : function (nh) {
return this.each(function (){
var $t = this;
if(!$t.grid) {return;}
$($t.grid.bDiv).css({height: nh+(isNaN(nh)?"":"px")});
$t.p.height = nh;
if ($t.p.scroll) { $t.grid.populateVisible(); }
});
},
setCaption : function (newcap){
return this.each(function(){
this.p.caption=newcap;
$("span.ui-jqgrid-title",this.grid.cDiv).html(newcap);
$(this.grid.cDiv).show();
});
},
setLabel : function(colname, nData, prop, attrp ){
return this.each(function(){
var $t = this, pos=-1;
if(!$t.grid) {return;}
if(isNaN(colname)) {
$($t.p.colModel).each(function(i){
if (this.name == colname) {
pos = i;return false;
}
});
} else {pos = parseInt(colname,10);}
if(pos>=0) {
var thecol = $("tr.ui-jqgrid-labels th:eq("+pos+")",$t.grid.hDiv);
if (nData){
var ico = $(".s-ico",thecol);
$("[id^=jqgh_]",thecol).empty().html(nData).append(ico);
$t.p.colNames[pos] = nData;
}
if (prop) {
if(typeof prop === 'string') {$(thecol).addClass(prop);} else {$(thecol).css(prop);}
}
if(typeof attrp === 'object') {$(thecol).attr(attrp);}
}
});
},
setCell : function(rowid,colname,nData,cssp,attrp, forceupd) {
return this.each(function(){
var $t = this, pos =-1,v, title;
if(!$t.grid) {return;}
if(isNaN(colname)) {
$($t.p.colModel).each(function(i){
if (this.name == colname) {
pos = i;return false;
}
});
} else {pos = parseInt(colname,10);}
if(pos>=0) {
var ind = $t.rows.namedItem(rowid);
if (ind){
var tcell = $("td:eq("+pos+")",ind);
if(nData !== "" || forceupd === true) {
v = $t.formatter(rowid, nData, pos,ind,'edit');
title = $t.p.colModel[pos].title ? {"title":$.jgrid.stripHtml(v)} : {};
if($t.p.treeGrid && $(".tree-wrap",$(tcell)).length>0) {
$("span",$(tcell)).html(v).attr(title);
} else {
$(tcell).html(v).attr(title);
}
if($t.p.datatype == "local") {
var cm = $t.p.colModel[pos], index;
nData = cm.formatter && typeof(cm.formatter) === 'string' && cm.formatter == 'date' ? $.unformat.date(nData,cm) : nData;
index = $t.p._index[rowid];
if(typeof index != "undefined") {
$t.p.data[index][cm.name] = nData;
}
}
}
if(typeof cssp === 'string'){
$(tcell).addClass(cssp);
} else if(cssp) {
$(tcell).css(cssp);
}
if(typeof attrp === 'object') {$(tcell).attr(attrp);}
}
}
});
},
getCell : function(rowid,col) {
var ret = false;
this.each(function(){
var $t=this, pos=-1;
if(!$t.grid) {return;}
if(isNaN(col)) {
$($t.p.colModel).each(function(i){
if (this.name === col) {
pos = i;return false;
}
});
} else {pos = parseInt(col,10);}
if(pos>=0) {
var ind = $t.rows.namedItem(rowid);
if(ind) {
try {
ret = $.unformat($("td:eq("+pos+")",ind),{rowId:ind.id, colModel:$t.p.colModel[pos]},pos);
} catch (e){
ret = $.jgrid.htmlDecode($("td:eq("+pos+")",ind).html());
}
}
}
});
return ret;
},
getCol : function (col, obj, mathopr) {
var ret = [], val, sum=0;
obj = typeof (obj) != 'boolean' ? false : obj;
if(typeof mathopr == 'undefined') { mathopr = false; }
this.each(function(){
var $t=this, pos=-1;
if(!$t.grid) {return;}
if(isNaN(col)) {
$($t.p.colModel).each(function(i){
if (this.name === col) {
pos = i;return false;
}
});
} else {pos = parseInt(col,10);}
if(pos>=0) {
var ln = $t.rows.length, i =0;
if (ln && ln>0){
while(i<ln){
if($($t.rows[i]).hasClass('jqgrow')) {
try {
val = $.unformat($($t.rows[i].cells[pos]),{rowId:$t.rows[i].id, colModel:$t.p.colModel[pos]},pos);
} catch (e) {
val = $.jgrid.htmlDecode($t.rows[i].cells[pos].innerHTML);
}
if(mathopr) { sum += parseFloat(val); }
else if(obj) { ret.push({id:$t.rows[i].id,value:val}); }
else { ret[i]=val; }
}
i++;
}
if(mathopr) {
switch(mathopr.toLowerCase()){
case 'sum': ret =sum; break;
case 'avg': ret = sum/ln; break;
case 'count': ret = ln; break;
}
}
}
}
});
return ret;
},
clearGridData : function(clearfooter) {
return this.each(function(){
var $t = this;
if(!$t.grid) {return;}
if(typeof clearfooter != 'boolean') { clearfooter = false; }
if($t.p.deepempty) {$("#"+$t.p.id+" tbody:first tr:gt(0)").remove();}
else {
var trf = $("#"+$t.p.id+" tbody:first tr:first")[0];
$("#"+$t.p.id+" tbody:first").empty().append(trf);
}
if($t.p.footerrow && clearfooter) { $(".ui-jqgrid-ftable td",$t.grid.sDiv).html(" "); }
$t.p.selrow = null; $t.p.selarrrow= []; $t.p.savedRow = [];
$t.p.records = 0;$t.p.page=1;$t.p.lastpage=0;$t.p.reccount=0;
$t.p.data = []; $t.p_index = {};
$t.updatepager(true,false);
});
},
getInd : function(rowid,rc){
var ret =false,rw;
this.each(function(){
rw = this.rows.namedItem(rowid);
if(rw) {
ret = rc===true ? rw: rw.rowIndex;
}
});
return ret;
}
});
})(jQuery);
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/3.8.2/src/grid.base.js | JavaScript | art | 106,494 |
/* Plugin: searchFilter v1.2.9
* Author: Kasey Speakman (kasey@cornerspeed.com)
* License: Dual Licensed, MIT and GPL v2 (http://www.gnu.org/licenses/gpl-2.0.html)
*
* REQUIREMENTS:
* jQuery 1.3+ (http://jquery.com/)
* A Themeroller Theme (http://jqueryui.com/themeroller/)
*
* SECURITY WARNING
* You should always implement server-side checking to ensure that
* the query will fail when forged/invalid data is received.
* Clever users can send any value they want through JavaScript and HTTP POST/GET.
*
* THEMES
* Simply include the CSS file for your Themeroller theme.
*
* DESCRIPTION
* This plugin creates a new searchFilter object in the specified container
*
* INPUT TYPE
* fields: an array of field objects. each object has the following properties:
* text: a string containing the display name of the field (e.g. "Field 1")
* itemval: a string containing the actual field name (e.g. "field1")
* optional properties:
* ops: an array of operators in the same format as jQuery.fn.searchFilter.defaults.operators
* that is: [ { op: 'gt', text: 'greater than'}, { op:'lt', text: 'less than'}, ... ]
* if not specified, the passed-in options used, and failting that, jQuery.fn.searchFilter.defaults.operators will be used
* *** NOTE ***
* Specifying a dataUrl or dataValues property means that a <select ...> (drop-down-list) will be generated
* instead of a text input <input type='text'.../> where the user would normally type in their search data
* ************
* dataUrl: a url that will return the html select for this field, this url will only be called once for this field
* dataValues: the possible values for this field in the form [ { text: 'Data Display Text', value: 'data_actual_value' }, { ... } ]
* dataInit: a function that you can use to initialize the data field. this function is passed the jQuery-fied data element
* dataEvents: list of events to apply to the data element. uses $("#id").bind(type, [data], fn) to bind events to data element
* *** JSON of this object could look like this: ***
* var fields = [
* {
* text: 'Field Display Name',
* itemval: 'field_actual_name',
* // below this are optional values
* ops: [ // this format is the same as jQuery.fn.searchFilter.defaults.operators
* { op: 'gt', text: 'greater than' },
* { op: 'lt', text: 'less than' }
* ],
* dataUrl: 'http://server/path/script.php?propName=propValue', // using this creates a select for the data input instead of an input type='text'
* dataValues: [ // using this creates a select for the data input instead of an input type='text'
* { text: 'Data Value Display Name', value: 'data_actual_value' },
* { ... }
* ],
* dataInit: function(jElem) { jElem.datepicker(options); },
* dataEvents: [ // these are the same options that you pass to $("#id").bind(type, [data], fn)
* { type: 'click', data: { i: 7 }, fn: function(e) { console.log(e.data.i); } },
* { type: 'keypress', fn: function(e) { console.log('keypress'); } }
* ]
* },
* { ... }
* ]
* options: name:value properties containing various creation options
* see jQuery.fn.searchFilter.defaults for the overridable options
*
* RETURN TYPE: This plugin returns a SearchFilter object, which has additional SearchFilter methods:
* Methods
* add: Adds a filter. added to the end of the list unless a jQuery event object or valid row number is passed.
* del: Removes a filter. removed from the end of the list unless a jQuery event object or valid row number is passed.
* reset: resets filters back to original state (only one blank filter), and calls onReset
* search: puts the search rules into an object and calls onSearch with it
* close: calls the onClose event handler
*
* USAGE
* HTML
* <head>
* ...
* <script src="path/to/jquery.min.js" type="text/javascript"></script>
* <link href="path/to/themeroller.css" rel="Stylesheet" type="text/css" />
* <script src="path/to/jquery.searchFilter.js" type="text/javascript"></script>
* <link href="path/to/jquery.searchFilter.css" rel="Stylesheet" type="text/css" />
* ...
* </head>
* <body>
* ...
* <div id='mySearch'></div>
* ...
* </body>
* JQUERY
* Methods
* initializing: $("#mySearch").searchFilter([{text: "Field 1", value: "field1"},{text: "Field 2", value: "field2"}], {onSearch: myFilterRuleReceiverFn, onReset: myFilterResetFn });
* Manual Methods (there's no need to call these methods unless you are trying to manipulate searchFilter with script)
* add: $("#mySearch").searchFilter().add(); // appends a blank filter
* $("#mySearch").searchFilter().add(0); // copies the first filter as second
* del: $("#mySearch").searchFilter().del(); // removes the bottom filter
* $("#mySearch").searchFilter().del(1); // removes the second filter
* search: $("#mySearch").searchFilter().search(); // invokes onSearch, passing it a ruleGroup object
* reset: $("#mySearch").searchFilter().reset(); // resets rules and invokes onReset
* close: $("#mySearch").searchFilter().close(); // without an onClose handler, equivalent to $("#mySearch").hide();
*
* NOTE: You can get the jQuery object back from the SearchFilter object by chaining .$
* Example
* $("#mySearch").searchFilter().add().add().reset().$.hide();
* Verbose Example
* $("#mySearch") // gets jQuery object for the HTML element with id="mySearch"
* .searchFilter() // gets the SearchFilter object for an existing search filter
* .add() // adds a new filter to the end of the list
* .add() // adds another new filter to the end of the list
* .reset() // resets filters back to original state, triggers onReset
* .$ // returns jQuery object for $("#mySearch")
* .hide(); // equivalent to $("#mySearch").hide();
*/
jQuery.fn.searchFilter = function(fields, options) {
function SearchFilter(jQ, fields, options) {
//---------------------------------------------------------------
// PUBLIC VARS
//---------------------------------------------------------------
this.$ = jQ; // makes the jQuery object available as .$ from the return value
//---------------------------------------------------------------
// PUBLIC FUNCTIONS
//---------------------------------------------------------------
this.add = function(i) {
if (i == null) jQ.find(".ui-add-last").click();
else jQ.find(".sf:eq(" + i + ") .ui-add").click();
return this;
};
this.del = function(i) {
if (i == null) jQ.find(".sf:last .ui-del").click();
else jQ.find(".sf:eq(" + i + ") .ui-del").click();
return this;
};
this.search = function(e) {
jQ.find(".ui-search").click();
return this;
};
this.reset = function(o) {
if(o===undefined) o = false;
jQ.find(".ui-reset").trigger('click',[o]);
return this;
};
this.close = function() {
jQ.find(".ui-closer").click();
return this;
};
//---------------------------------------------------------------
// "CONSTRUCTOR" (in air quotes)
//---------------------------------------------------------------
if (fields != null) { // type coercion matches undefined as well as null
//---------------------------------------------------------------
// UTILITY FUNCTIONS
//---------------------------------------------------------------
function hover() {
jQuery(this).toggleClass("ui-state-hover");
return false;
}
function active(e) {
jQuery(this).toggleClass("ui-state-active", (e.type == "mousedown"));
return false;
}
function buildOpt(value, text) {
return "<option value='" + value + "'>" + text + "</option>";
}
function buildSel(className, options, isHidden) {
return "<select class='" + className + "'" + (isHidden ? " style='display:none;'" : "") + ">" + options + "</select>";
}
function initData(selector, fn) {
var jElem = jQ.find("tr.sf td.data " + selector);
if (jElem[0] != null)
fn(jElem);
}
function bindDataEvents(selector, events) {
var jElem = jQ.find("tr.sf td.data " + selector);
if (jElem[0] != null) {
jQuery.each(events, function() {
if (this.data != null)
jElem.bind(this.type, this.data, this.fn);
else
jElem.bind(this.type, this.fn);
});
}
}
//---------------------------------------------------------------
// SUPER IMPORTANT PRIVATE VARS
//---------------------------------------------------------------
// copies jQuery.fn.searchFilter.defaults.options properties onto an empty object, then options onto that
var opts = jQuery.extend({}, jQuery.fn.searchFilter.defaults, options);
// this is keeps track of the last asynchronous setup
var highest_late_setup = -1;
//---------------------------------------------------------------
// CREATION PROCESS STARTS
//---------------------------------------------------------------
// generate the global ops
var gOps_html = "";
jQuery.each(opts.groupOps, function() { gOps_html += buildOpt(this.op, this.text); });
gOps_html = "<select name='groupOp'>" + gOps_html + "</select>";
/* original content - doesn't minify very well
jQ
.html("") // clear any old content
.addClass("ui-searchFilter") // add classes
.append( // add content
"\
<div class='ui-widget-overlay' style='z-index: -1'> </div>\
<table class='ui-widget-content ui-corner-all'>\
<thead>\
<tr>\
<td colspan='5' class='ui-widget-header ui-corner-all' style='line-height: 18px;'>\
<div class='ui-closer ui-state-default ui-corner-all ui-helper-clearfix' style='float: right;'>\
<span class='ui-icon ui-icon-close'></span>\
</div>\
" + opts.windowTitle + "\
</td>\
</tr>\
</thead>\
<tbody>\
<tr class='sf'>\
<td class='fields'></td>\
<td class='ops'></td>\
<td class='data'></td>\
<td><div class='ui-del ui-state-default ui-corner-all'><span class='ui-icon ui-icon-minus'></span></div></td>\
<td><div class='ui-add ui-state-default ui-corner-all'><span class='ui-icon ui-icon-plus'></span></div></td>\
</tr>\
<tr>\
<td colspan='5' class='divider'><div> </div></td>\
</tr>\
</tbody>\
<tfoot>\
<tr>\
<td colspan='3'>\
<span class='ui-reset ui-state-default ui-corner-all' style='display: inline-block; float: left;'><span class='ui-icon ui-icon-arrowreturnthick-1-w' style='float: left;'></span><span style='line-height: 18px; padding: 0 7px 0 3px;'>" + opts.resetText + "</span></span>\
<span class='ui-search ui-state-default ui-corner-all' style='display: inline-block; float: right;'><span class='ui-icon ui-icon-search' style='float: left;'></span><span style='line-height: 18px; padding: 0 7px 0 3px;'>" + opts.searchText + "</span></span>\
<span class='matchText'>" + opts.matchText + "</span> \
" + gOps_html + " \
<span class='rulesText'>" + opts.rulesText + "</span>\
</td>\
<td> </td>\
<td><div class='ui-add-last ui-state-default ui-corner-all'><span class='ui-icon ui-icon-plusthick'></span></div></td>\
</tr>\
</tfoot>\
</table>\
");
/* end hard-to-minify code */
/* begin easier to minify code */
jQ.html("").addClass("ui-searchFilter").append("<div class='ui-widget-overlay' style='z-index: -1'> </div><table class='ui-widget-content ui-corner-all'><thead><tr><td colspan='5' class='ui-widget-header ui-corner-all' style='line-height: 18px;'><div class='ui-closer ui-state-default ui-corner-all ui-helper-clearfix' style='float: right;'><span class='ui-icon ui-icon-close'></span></div>" + opts.windowTitle + "</td></tr></thead><tbody><tr class='sf'><td class='fields'></td><td class='ops'></td><td class='data'></td><td><div class='ui-del ui-state-default ui-corner-all'><span class='ui-icon ui-icon-minus'></span></div></td><td><div class='ui-add ui-state-default ui-corner-all'><span class='ui-icon ui-icon-plus'></span></div></td></tr><tr><td colspan='5' class='divider'><hr class='ui-widget-content' style='margin:1px'/></td></tr></tbody><tfoot><tr><td colspan='3'><span class='ui-reset ui-state-default ui-corner-all' style='display: inline-block; float: left;'><span class='ui-icon ui-icon-arrowreturnthick-1-w' style='float: left;'></span><span style='line-height: 18px; padding: 0 7px 0 3px;'>" + opts.resetText + "</span></span><span class='ui-search ui-state-default ui-corner-all' style='display: inline-block; float: right;'><span class='ui-icon ui-icon-search' style='float: left;'></span><span style='line-height: 18px; padding: 0 7px 0 3px;'>" + opts.searchText + "</span></span><span class='matchText'>" + opts.matchText + "</span> " + gOps_html + " <span class='rulesText'>" + opts.rulesText + "</span></td><td> </td><td><div class='ui-add-last ui-state-default ui-corner-all'><span class='ui-icon ui-icon-plusthick'></span></div></td></tr></tfoot></table>");
/* end easier-to-minify code */
var jRow = jQ.find("tr.sf");
var jFields = jRow.find("td.fields");
var jOps = jRow.find("td.ops");
var jData = jRow.find("td.data");
// generate the defaults
var default_ops_html = "";
jQuery.each(opts.operators, function() { default_ops_html += buildOpt(this.op, this.text); });
default_ops_html = buildSel("default", default_ops_html, true);
jOps.append(default_ops_html);
var default_data_html = "<input type='text' class='default' style='display:none;' />";
jData.append(default_data_html);
// generate the field list as a string
var fields_html = "";
var has_custom_ops = false;
var has_custom_data = false;
jQuery.each(fields, function(i) {
var field_num = i;
fields_html += buildOpt(this.itemval, this.text);
// add custom ops if they exist
if (this.ops != null) {
has_custom_ops = true;
var custom_ops = "";
jQuery.each(this.ops, function() { custom_ops += buildOpt(this.op, this.text); });
custom_ops = buildSel("field" + field_num, custom_ops, true);
jOps.append(custom_ops);
}
// add custom data if it is given
if (this.dataUrl != null) {
if (i > highest_late_setup) highest_late_setup = i;
has_custom_data = true;
var dEvents = this.dataEvents;
var iEvent = this.dataInit;
var bs = this.buildSelect;
jQuery.ajax(jQuery.extend({
url : this.dataUrl,
complete: function(data) {
var $d;
if(bs != null) $d =jQuery("<div />").append(bs(data));
else $d = jQuery("<div />").append(data.responseText);
$d.find("select").addClass("field" + field_num).hide();
jData.append($d.html());
if (iEvent) initData(".field" + i, iEvent);
if (dEvents) bindDataEvents(".field" + i, dEvents);
if (i == highest_late_setup) { // change should get called no more than twice when this searchFilter is constructed
jQ.find("tr.sf td.fields select[name='field']").change();
}
}
},opts.ajaxSelectOptions));
} else if (this.dataValues != null) {
has_custom_data = true;
var custom_data = "";
jQuery.each(this.dataValues, function() { custom_data += buildOpt(this.value, this.text); });
custom_data = buildSel("field" + field_num, custom_data, true);
jData.append(custom_data);
} else if (this.dataEvents != null || this.dataInit != null) {
has_custom_data = true;
var custom_data = "<input type='text' class='field" + field_num + "' />";
jData.append(custom_data);
}
// attach events to data if they exist
if (this.dataInit != null && i != highest_late_setup)
initData(".field" + i, this.dataInit);
if (this.dataEvents != null && i != highest_late_setup)
bindDataEvents(".field" + i, this.dataEvents);
});
fields_html = "<select name='field'>" + fields_html + "</select>";
jFields.append(fields_html);
// setup the field select with an on-change event if there are custom ops or data
var jFSelect = jFields.find("select[name='field']");
if (has_custom_ops) jFSelect.change(function(e) {
var index = e.target.selectedIndex;
var td = jQuery(e.target).parents("tr.sf").find("td.ops");
td.find("select").removeAttr("name").hide(); // disown and hide all elements
var jElem = td.find(".field" + index);
if (jElem[0] == null) jElem = td.find(".default"); // if there's not an element for that field, use the default one
jElem.attr("name", "op").show();
return false;
});
else jOps.find(".default").attr("name", "op").show();
if (has_custom_data) jFSelect.change(function(e) {
var index = e.target.selectedIndex;
var td = jQuery(e.target).parents("tr.sf").find("td.data");
td.find("select,input").removeClass("vdata").hide(); // disown and hide all elements
var jElem = td.find(".field" + index);
if (jElem[0] == null) jElem = td.find(".default"); // if there's not an element for that field, use the default one
jElem.show().addClass("vdata");
return false;
});
else jData.find(".default").show().addClass("vdata");
// go ahead and call the change event and setup the ops and data values
if (has_custom_ops || has_custom_data) jFSelect.change();
// bind events
jQ.find(".ui-state-default").hover(hover, hover).mousedown(active).mouseup(active); // add hover/active effects to all buttons
jQ.find(".ui-closer").click(function(e) {
opts.onClose(jQuery(jQ.selector));
return false;
});
jQ.find(".ui-del").click(function(e) {
var row = jQuery(e.target).parents(".sf");
if (row.siblings(".sf").length > 0) { // doesn't remove if there's only one filter left
if (opts.datepickerFix === true && jQuery.fn.datepicker !== undefined)
row.find(".hasDatepicker").datepicker("destroy"); // clean up datepicker's $.data mess
row.remove(); // also unbinds
} else { // resets the filter if it's the last one
row.find("select[name='field']")[0].selectedIndex = 0;
row.find("select[name='op']")[0].selectedIndex = 0;
row.find(".data input").val(""); // blank all input values
row.find(".data select").each(function() { this.selectedIndex = 0; }); // select first option on all selects
row.find("select[name='field']").change(function(event){event.stopPropagation();}); // trigger any change events
}
return false;
});
jQ.find(".ui-add").click(function(e) {
var row = jQuery(e.target).parents(".sf");
var newRow = row.clone(true).insertAfter(row);
newRow.find(".ui-state-default").removeClass("ui-state-hover ui-state-active");
if (opts.clone) {
newRow.find("select[name='field']")[0].selectedIndex = row.find("select[name='field']")[0].selectedIndex;
var stupid_browser = (newRow.find("select[name='op']")[0] == null); // true for IE6
if (!stupid_browser)
newRow.find("select[name='op']").focus()[0].selectedIndex = row.find("select[name='op']")[0].selectedIndex;
var jElem = newRow.find("select.vdata");
if (jElem[0] != null) // select doesn't copy it's selected index when cloned
jElem[0].selectedIndex = row.find("select.vdata")[0].selectedIndex;
} else {
newRow.find(".data input").val(""); // blank all input values
newRow.find("select[name='field']").focus();
}
if (opts.datepickerFix === true && jQuery.fn.datepicker !== undefined) { // using $.data to associate data with document elements is Not Good
row.find(".hasDatepicker").each(function() {
var settings = jQuery.data(this, "datepicker").settings;
newRow.find("#" + this.id).unbind().removeAttr("id").removeClass("hasDatepicker").datepicker(settings);
});
}
newRow.find("select[name='field']").change(function(event){event.stopPropagation();} );
return false;
});
jQ.find(".ui-search").click(function(e) {
var ui = jQuery(jQ.selector); // pointer to search box wrapper element
var ruleGroup;
var group_op = ui.find("select[name='groupOp'] :selected").val(); // puls "AND" or "OR"
if (!opts.stringResult) {
ruleGroup = {
groupOp: group_op,
rules: []
};
} else {
ruleGroup = "{\"groupOp\":\"" + group_op + "\",\"rules\":[";
}
ui.find(".sf").each(function(i) {
var tField = jQuery(this).find("select[name='field'] :selected").val();
var tOp = jQuery(this).find("select[name='op'] :selected").val();
var tData = jQuery(this).find("input.vdata,select.vdata :selected").val();
tData += "";
tData = tData.replace(/\\/g,'\\\\').replace(/\"/g,'\\"');
if (!opts.stringResult) {
ruleGroup.rules.push({
field: tField,
op: tOp,
data: tData
});
} else {
if (i > 0) ruleGroup += ",";
ruleGroup += "{\"field\":\"" + tField + "\",";
ruleGroup += "\"op\":\"" + tOp + "\",";
ruleGroup += "\"data\":\"" + tData + "\"}";
}
});
if (opts.stringResult) ruleGroup += "]}";
opts.onSearch(ruleGroup);
return false;
});
jQ.find(".ui-reset").click(function(e,op) {
var ui = jQuery(jQ.selector);
ui.find(".ui-del").click(); // removes all filters, resets the last one
ui.find("select[name='groupOp']")[0].selectedIndex = 0; // changes the op back to the default one
opts.onReset(op);
return false;
});
jQ.find(".ui-add-last").click(function() {
var row = jQuery(jQ.selector + " .sf:last");
var newRow = row.clone(true).insertAfter(row);
newRow.find(".ui-state-default").removeClass("ui-state-hover ui-state-active");
newRow.find(".data input").val(""); // blank all input values
newRow.find("select[name='field']").focus();
if (opts.datepickerFix === true && jQuery.fn.datepicker !== undefined) { // using $.data to associate data with document elements is Not Good
row.find(".hasDatepicker").each(function() {
var settings = jQuery.data(this, "datepicker").settings;
newRow.find("#" + this.id).unbind().removeAttr("id").removeClass("hasDatepicker").datepicker(settings);
});
}
newRow.find("select[name='field']").change(function(event){event.stopPropagation();});
return false;
});
this.setGroupOp = function(setting) {
/* a "setter" for groupping argument.
* ("AND" or "OR")
*
* Inputs:
* setting - a string
*
* Returns:
* Does not return anything. May add success / failure reporting in future versions.
*
* author: Daniel Dotsenko (dotsa@hotmail.com)
*/
selDOMobj = jQ.find("select[name='groupOp']")[0];
var indexmap = {}, l = selDOMobj.options.length, i;
for (i=0; i<l; i++) {
indexmap[selDOMobj.options[i].value] = i;
}
selDOMobj.selectedIndex = indexmap[setting];
jQuery(selDOMobj).change(function(event){event.stopPropagation();});
};
this.setFilter = function(settings) {
/* a "setter" for an arbitrary SearchFilter's filter line.
* designed to abstract the DOM manipulations required to infer
* a particular filter is a fit to the search box.
*
* Inputs:
* settings - an "object" (dictionary)
* index (optional*) (to be implemented in the future) : signed integer index (from top to bottom per DOM) of the filter line to fill.
* Negative integers (rooted in -1 and lower) denote position of the line from the bottom.
* sfref (optional*) : DOM object referencing individual '.sf' (normally a TR element) to be populated. (optional)
* filter (mandatory) : object (dictionary) of form {'field':'field_value','op':'op_value','data':'data value'}
*
* * It is mandatory to have either index or sfref defined.
*
* Returns:
* Does not return anything. May add success / failure reporting in future versions.
*
* author: Daniel Dotsenko (dotsa@hotmail.com)
*/
var o = settings['sfref'], filter = settings['filter'];
// setting up valueindexmap that we will need to manipulate SELECT elements.
var fields = [], i, j , l, lj, li,
valueindexmap = {};
// example of valueindexmap:
// {'field1':{'index':0,'ops':{'eq':0,'ne':1}},'fieldX':{'index':1,'ops':{'eq':0,'ne':1},'data':{'true':0,'false':1}}},
// if data is undefined it's a INPUT field. If defined, it's SELECT
selDOMobj = o.find("select[name='field']")[0];
for (i=0, l=selDOMobj.options.length; i<l; i++) {
valueindexmap[selDOMobj.options[i].value] = {'index':i,'ops':{}};
fields.push(selDOMobj.options[i].value);
}
for (i=0, li=fields.length; i < li; i++) {
selDOMobj = o.find(".ops > select[class='field"+i+"']")[0];
if (selDOMobj) {
for (j=0, lj=selDOMobj.options.length; j<lj; j++) {
valueindexmap[fields[i]]['ops'][selDOMobj.options[j].value] = j;
}
}
selDOMobj = o.find(".data > select[class='field"+i+"']")[0];
if (selDOMobj) {
valueindexmap[fields[i]]['data'] = {}; // this setting is the flag that 'data' is contained in a SELECT
for (j=0, lj=selDOMobj.options.length; j<lj; j++) {
valueindexmap[fields[i]]['data'][selDOMobj.options[j].value] = j;
}
}
} // done populating valueindexmap
// preparsing the index values for SELECT elements.
var fieldvalue, fieldindex, opindex, datavalue, dataindex;
fieldvalue = filter['field'];
if (valueindexmap[fieldvalue]) {
fieldindex = valueindexmap[fieldvalue]['index'];
}
if (fieldindex != null) {
opindex = valueindexmap[fieldvalue]['ops'][filter['op']];
if(opindex === undefined) {
for(i=0,li=options.operators.length; i<li;i++) {
if(options.operators[i].op == filter.op ){
opindex = i;
break;
}
}
}
datavalue = filter['data'];
if (valueindexmap[fieldvalue]['data'] == null) {
dataindex = -1; // 'data' is not SELECT, Making the var 'defined'
} else {
dataindex = valueindexmap[fieldvalue]['data'][datavalue]; // 'undefined' may come from here.
}
}
// only if values for 'field' and 'op' and 'data' are 'found' in mapping...
if (fieldindex != null && opindex != null && dataindex != null) {
o.find("select[name='field']")[0].selectedIndex = fieldindex;
o.find("select[name='field']").change();
o.find("select[name='op']")[0].selectedIndex = opindex;
o.find("input.vdata").val(datavalue); // if jquery does not find any INPUT, it does not set any. This means we deal with SELECT
o = o.find("select.vdata")[0];
if (o) {
o.selectedIndex = dataindex;
}
return true
} else {
return false
}
}; // end of this.setFilter fn
} // end of if fields != null
}
return new SearchFilter(this, fields, options);
};
jQuery.fn.searchFilter.version = '1.2.9';
/* This property contains the default options */
jQuery.fn.searchFilter.defaults = {
/*
* PROPERTY
* TYPE: boolean
* DESCRIPTION: clone a row if it is added from an existing row
* when false, any new added rows will be blank.
*/
clone: true,
/*
* PROPERTY
* TYPE: boolean
* DESCRIPTION: current version of datepicker uses a data store,
* which is incompatible with $().clone(true)
*/
datepickerFix: true,
/*
* FUNCTION
* DESCRIPTION: the function that will be called when the user clicks Reset
* INPUT TYPE: JS object if stringResult is false, otherwise is JSON string
*/
onReset: function(data) { alert("Reset Clicked. Data Returned: " + data) },
/*
* FUNCTION
* DESCRIPTION: the function that will be called when the user clicks Search
* INPUT TYPE: JS object if stringResult is false, otherwise is JSON string
*/
onSearch: function(data) { alert("Search Clicked. Data Returned: " + data) },
/*
* FUNCTION
* DESCRIPTION: the function that will be called when the user clicks the Closer icon
* or the close() function is called
* if left null, it simply does a .hide() on the searchFilter
* INPUT TYPE: a jQuery object for the searchFilter
*/
onClose: function(jElem) { jElem.hide(); },
/*
* PROPERTY
* TYPE: array of objects, each object has the properties op and text
* DESCRIPTION: the selectable operators that are applied between rules
* e.g. for {op:"AND", text:"all"}
* the search filter box will say: match all rules
* the server should interpret this as putting the AND op between each rule:
* rule1 AND rule2 AND rule3
* text will be the option text, and op will be the option value
*/
groupOps: [
{ op: "AND", text: "all" },
{ op: "OR", text: "any" }
],
/*
* PROPERTY
* TYPE: array of objects, each object has the properties op and text
* DESCRIPTION: the operators that will appear as drop-down options
* text will be the option text, and op will be the option value
*/
operators: [
{ op: "eq", text: "is equal to" },
{ op: "ne", text: "is not equal to" },
{ op: "lt", text: "is less than" },
{ op: "le", text: "is less or equal to" },
{ op: "gt", text: "is greater than" },
{ op: "ge", text: "is greater or equal to" },
{ op: "in", text: "is in" },
{ op: "ni", text: "is not in" },
{ op: "bw", text: "begins with" },
{ op: "bn", text: "does not begin with" },
{ op: "ew", text: "ends with" },
{ op: "en", text: "does not end with" },
{ op: "cn", text: "contains" },
{ op: "nc", text: "does not contain" }
],
/*
* PROPERTY
* TYPE: string
* DESCRIPTION: part of the phrase: _match_ ANY/ALL rules
*/
matchText: "match",
/*
* PROPERTY
* TYPE: string
* DESCRIPTION: part of the phrase: match ANY/ALL _rules_
*/
rulesText: "rules",
/*
* PROPERTY
* TYPE: string
* DESCRIPTION: the text that will be displayed in the reset button
*/
resetText: "Reset",
/*
* PROPERTY
* TYPE: string
* DESCRIPTION: the text that will be displayed in the search button
*/
searchText: "Search",
/*
* PROPERTY
* TYPE: boolean
* DESCRIPTION: a flag that, when set, will make the onSearch and onReset return strings instead of objects
*/
stringResult: true,
/*
* PROPERTY
* TYPE: string
* DESCRIPTION: the title of the searchFilter window
*/
windowTitle: "Search Rules",
/*
* PROPERTY
* TYPE: object
* DESCRIPTION: options to extend the ajax request
*/
ajaxSelectOptions : {}
}; /* end of searchFilter */ | zzh-simple-hr | ZJs/webapp/grid/jqgrid/3.8.2/src/jquery.searchFilter.js | JavaScript | art | 37,799 |
/*
Transform a table to a jqGrid.
Peter Romianowski <peter.romianowski@optivo.de>
If the first column of the table contains checkboxes or
radiobuttons then the jqGrid is made selectable.
*/
// Addition - selector can be a class or id
function tableToGrid(selector, options) {
jQuery(selector).each(function() {
if(this.grid) {return;} //Adedd from Tony Tomov
// This is a small "hack" to make the width of the jqGrid 100%
jQuery(this).width("99%");
var w = jQuery(this).width();
// Text whether we have single or multi select
var inputCheckbox = jQuery('input[type=checkbox]:first', jQuery(this));
var inputRadio = jQuery('input[type=radio]:first', jQuery(this));
var selectMultiple = inputCheckbox.length > 0;
var selectSingle = !selectMultiple && inputRadio.length > 0;
var selectable = selectMultiple || selectSingle;
//var inputName = inputCheckbox.attr("name") || inputRadio.attr("name");
// Build up the columnModel and the data
var colModel = [];
var colNames = [];
jQuery('th', jQuery(this)).each(function() {
if (colModel.length === 0 && selectable) {
colModel.push({
name: '__selection__',
index: '__selection__',
width: 0,
hidden: true
});
colNames.push('__selection__');
} else {
colModel.push({
name: jQuery(this).attr("id") || jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(' ').join('_'),
index: jQuery(this).attr("id") || jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(' ').join('_'),
width: jQuery(this).width() || 150
});
colNames.push(jQuery(this).html());
}
});
var data = [];
var rowIds = [];
var rowChecked = [];
jQuery('tbody > tr', jQuery(this)).each(function() {
var row = {};
var rowPos = 0;
jQuery('td', jQuery(this)).each(function() {
if (rowPos === 0 && selectable) {
var input = jQuery('input', jQuery(this));
var rowId = input.attr("value");
rowIds.push(rowId || data.length);
if (input.attr("checked")) {
rowChecked.push(rowId);
}
row[colModel[rowPos].name] = input.attr("value");
} else {
row[colModel[rowPos].name] = jQuery(this).html();
}
rowPos++;
});
if(rowPos >0) { data.push(row); }
});
// Clear the original HTML table
jQuery(this).empty();
// Mark it as jqGrid
jQuery(this).addClass("scroll");
jQuery(this).jqGrid(jQuery.extend({
datatype: "local",
width: w,
colNames: colNames,
colModel: colModel,
multiselect: selectMultiple
//inputName: inputName,
//inputValueCol: imputName != null ? "__selection__" : null
}, options || {}));
// Add data
var a;
for (a = 0; a < data.length; a++) {
var id = null;
if (rowIds.length > 0) {
id = rowIds[a];
if (id && id.replace) {
// We have to do this since the value of a checkbox
// or radio button can be anything
id = encodeURIComponent(id).replace(/[.\-%]/g, "_");
}
}
if (id === null) {
id = a + 1;
}
jQuery(this).jqGrid("addRowData",id, data[a]);
}
// Set the selection
for (a = 0; a < rowChecked.length; a++) {
jQuery(this).jqGrid("setSelection",rowChecked[a]);
}
});
};
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/3.8.2/src/grid.tbltogrid.js | JavaScript | art | 3,200 |
/*
* jqModal - Minimalist Modaling with jQuery
* (http://dev.iceburg.net/jquery/jqmodal/)
*
* Copyright (c) 2007,2008 Brice Burgess <bhb@iceburg.net>
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* $Version: 07/06/2008 +r13
*/
(function($) {
$.fn.jqm=function(o){
var p={
overlay: 50,
closeoverlay : true,
overlayClass: 'jqmOverlay',
closeClass: 'jqmClose',
trigger: '.jqModal',
ajax: F,
ajaxText: '',
target: F,
modal: F,
toTop: F,
onShow: F,
onHide: F,
onLoad: F
};
return this.each(function(){if(this._jqm)return H[this._jqm].c=$.extend({},H[this._jqm].c,o);s++;this._jqm=s;
H[s]={c:$.extend(p,$.jqm.params,o),a:F,w:$(this).addClass('jqmID'+s),s:s};
if(p.trigger)$(this).jqmAddTrigger(p.trigger);
});};
$.fn.jqmAddClose=function(e){return hs(this,e,'jqmHide');};
$.fn.jqmAddTrigger=function(e){return hs(this,e,'jqmShow');};
$.fn.jqmShow=function(t){return this.each(function(){$.jqm.open(this._jqm,t);});};
$.fn.jqmHide=function(t){return this.each(function(){$.jqm.close(this._jqm,t)});};
$.jqm = {
hash:{},
open:function(s,t){var h=H[s],c=h.c,cc='.'+c.closeClass,z=(parseInt(h.w.css('z-index')));z=(z>0)?z:3000;var o=$('<div></div>').css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:c.overlay/100});if(h.a)return F;h.t=t;h.a=true;h.w.css('z-index',z);
if(c.modal) {if(!A[0])setTimeout(function(){L('bind');},1);A.push(s);}
else if(c.overlay > 0) {if(c.closeoverlay) h.w.jqmAddClose(o);}
else o=F;
h.o=(o)?o.addClass(c.overlayClass).prependTo('body'):F;
if(ie6){$('html,body').css({height:'100%',width:'100%'});if(o){o=o.css({position:'absolute'})[0];for(var y in {Top:1,Left:1})o.style.setExpression(y.toLowerCase(),"(_=(document.documentElement.scroll"+y+" || document.body.scroll"+y+"))+'px'");}}
if(c.ajax) {var r=c.target||h.w,u=c.ajax;r=(typeof r == 'string')?$(r,h.w):$(r);u=(u.substr(0,1) == '@')?$(t).attr(u.substring(1)):u;
r.html(c.ajaxText).load(u,function(){if(c.onLoad)c.onLoad.call(this,h);if(cc)h.w.jqmAddClose($(cc,h.w));e(h);});}
else if(cc)h.w.jqmAddClose($(cc,h.w));
if(c.toTop&&h.o)h.w.before('<span id="jqmP'+h.w[0]._jqm+'"></span>').insertAfter(h.o);
(c.onShow)?c.onShow(h):h.w.show();e(h);return F;
},
close:function(s){var h=H[s];if(!h.a)return F;h.a=F;
if(A[0]){A.pop();if(!A[0])L('unbind');}
if(h.c.toTop&&h.o)$('#jqmP'+h.w[0]._jqm).after(h.w).remove();
if(h.c.onHide)h.c.onHide(h);else{h.w.hide();if(h.o)h.o.remove();} return F;
},
params:{}};
var s=0,H=$.jqm.hash,A=[],ie6=$.browser.msie&&($.browser.version == "6.0"),F=false,
e=function(h){var i=$('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0});if(ie6)if(h.o)h.o.html('<p style="width:100%;height:100%"/>').prepend(i);else if(!$('iframe.jqm',h.w)[0])h.w.prepend(i); f(h);},
f=function(h){try{$(':input:visible',h.w)[0].focus();}catch(_){}},
L=function(t){$(document)[t]("keypress",m)[t]("keydown",m)[t]("mousedown",m);},
m=function(e){var h=H[A[A.length-1]],r=(!$(e.target).parents('.jqmID'+h.s)[0]);if(r)f(h);return !r;},
hs=function(w,t,c){return w.each(function(){var s=this._jqm;$(t).each(function() {
if(!this[c]){this[c]=[];$(this).click(function(){for(var i in {jqmShow:1,jqmHide:1})for(var s in this[i])if(H[this[i][s]])H[this[i][s]].w[i](this);return F;});}this[c].push(s);});});};
})(jQuery); | zzh-simple-hr | ZJs/webapp/grid/jqgrid/3.8.2/src/jqModal.js | JavaScript | art | 3,472 |
;(function($){
/**
* jqGrid extension for custom methods
* Tony Tomov tony@trirand.com
* http://trirand.com/blog/
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl-2.0.html
**/
$.jgrid.extend({
getColProp : function(colname){
var ret ={}, $t = this[0];
if ( !$t.grid ) { return false; }
var cM = $t.p.colModel;
for ( var i =0;i<cM.length;i++ ) {
if ( cM[i].name == colname ) {
ret = cM[i];
break;
}
}
return ret;
},
setColProp : function(colname, obj){
//do not set width will not work
return this.each(function(){
if ( this.grid ) {
if ( obj ) {
var cM = this.p.colModel;
for ( var i =0;i<cM.length;i++ ) {
if ( cM[i].name == colname ) {
$.extend(this.p.colModel[i],obj);
break;
}
}
}
}
});
},
sortGrid : function(colname,reload, sor){
return this.each(function(){
var $t=this,idx=-1;
if ( !$t.grid ) { return;}
if ( !colname ) { colname = $t.p.sortname; }
for ( var i=0;i<$t.p.colModel.length;i++ ) {
if ( $t.p.colModel[i].index == colname || $t.p.colModel[i].name==colname ) {
idx = i;
break;
}
}
if ( idx!=-1 ){
var sort = $t.p.colModel[idx].sortable;
if ( typeof sort !== 'boolean' ) { sort = true; }
if ( typeof reload !=='boolean' ) { reload = false; }
if ( sort ) { $t.sortData("jqgh_"+colname, idx, reload, sor); }
}
});
},
GridDestroy : function () {
return this.each(function(){
if ( this.grid ) {
if ( this.p.pager ) { // if not part of grid
$(this.p.pager).remove();
}
var gid = this.id;
try {
$("#gbox_"+gid).remove();
} catch (_) {}
}
});
},
GridUnload : function(){
return this.each(function(){
if ( !this.grid ) {return;}
var defgrid = {id: $(this).attr('id'),cl: $(this).attr('class')};
if (this.p.pager) {
$(this.p.pager).empty().removeClass("ui-state-default ui-jqgrid-pager corner-bottom");
}
var newtable = document.createElement('table');
$(newtable).attr({id:defgrid.id});
newtable.className = defgrid.cl;
var gid = this.id;
$(newtable).removeClass("ui-jqgrid-btable");
if( $(this.p.pager).parents("#gbox_"+gid).length === 1 ) {
$(newtable).insertBefore("#gbox_"+gid).show();
$(this.p.pager).insertBefore("#gbox_"+gid);
} else {
$(newtable).insertBefore("#gbox_"+gid).show();
}
$("#gbox_"+gid).remove();
});
},
setGridState : function(state) {
return this.each(function(){
if ( !this.grid ) {return;}
var $t = this;
if(state == 'hidden'){
$(".ui-jqgrid-bdiv, .ui-jqgrid-hdiv","#gview_"+$t.p.id).slideUp("fast");
if($t.p.pager) {$($t.p.pager).slideUp("fast");}
if($t.p.toppager) {$($t.p.toppager).slideUp("fast");}
if($t.p.toolbar[0]===true) {
if( $t.p.toolbar[1]=='both') {
$($t.grid.ubDiv).slideUp("fast");
}
$($t.grid.uDiv).slideUp("fast");
}
if($t.p.footerrow) { $(".ui-jqgrid-sdiv","#gbox_"+$t.p.id).slideUp("fast"); }
$(".ui-jqgrid-titlebar-close span",$t.grid.cDiv).removeClass("ui-icon-circle-triangle-n").addClass("ui-icon-circle-triangle-s");
$t.p.gridstate = 'hidden';
} else if(state=='visible') {
$(".ui-jqgrid-hdiv, .ui-jqgrid-bdiv","#gview_"+$t.p.id).slideDown("fast");
if($t.p.pager) {$($t.p.pager).slideDown("fast");}
if($t.p.toppager) {$($t.p.toppager).slideDown("fast");}
if($t.p.toolbar[0]===true) {
if( $t.p.toolbar[1]=='both') {
$($t.grid.ubDiv).slideDown("fast");
}
$($t.grid.uDiv).slideDown("fast");
}
if($t.p.footerrow) { $(".ui-jqgrid-sdiv","#gbox_"+$t.p.id).slideDown("fast"); }
$(".ui-jqgrid-titlebar-close span",$t.grid.cDiv).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n");
$t.p.gridstate = 'visible';
}
});
},
updateGridRows : function (data, rowidname, jsonreader) {
var nm, success=false, title;
this.each(function(){
var t = this, vl, ind, srow, sid;
if(!t.grid) {return false;}
if(!rowidname) { rowidname = "id"; }
if( data && data.length >0 ) {
$(data).each(function(j){
srow = this;
ind = t.rows.namedItem(srow[rowidname]);
if(ind) {
sid = srow[rowidname];
if(jsonreader === true){
if(t.p.jsonReader.repeatitems === true) {
if(t.p.jsonReader.cell) {srow = srow[t.p.jsonReader.cell];}
for (var k=0;k<srow.length;k++) {
vl = t.formatter( sid, srow[k], k, srow, 'edit');
title = t.p.colModel[k].title ? {"title":$.jgrid.stripHtml(vl)} : {};
if(t.p.treeGrid===true && nm == t.p.ExpandColumn) {
$("td:eq("+k+") > span:first",ind).html(vl).attr(title);
} else {
$("td:eq("+k+")",ind).html(vl).attr(title);
}
}
success = true;
return true;
}
}
$(t.p.colModel).each(function(i){
nm = jsonreader===true ? this.jsonmap || this.name :this.name;
if( srow[nm] !== undefined) {
vl = t.formatter( sid, srow[nm], i, srow, 'edit');
title = this.title ? {"title":$.jgrid.stripHtml(vl)} : {};
if(t.p.treeGrid===true && nm == t.p.ExpandColumn) {
$("td:eq("+i+") > span:first",ind).html(vl).attr(title);
} else {
$("td:eq("+i+")",ind).html(vl).attr(title);
}
success = true;
}
});
}
});
}
});
return success;
},
filterGrid : function(gridid,p){
p = $.extend({
gridModel : false,
gridNames : false,
gridToolbar : false,
filterModel: [], // label/name/stype/defval/surl/sopt
formtype : "horizontal", // horizontal/vertical
autosearch: true, // if set to false a serch button should be enabled.
formclass: "filterform",
tableclass: "filtertable",
buttonclass: "filterbutton",
searchButton: "Search",
clearButton: "Clear",
enableSearch : false,
enableClear: false,
beforeSearch: null,
afterSearch: null,
beforeClear: null,
afterClear: null,
url : '',
marksearched: true
},p || {});
return this.each(function(){
var self = this;
this.p = p;
if(this.p.filterModel.length === 0 && this.p.gridModel===false) { alert("No filter is set"); return;}
if( !gridid) {alert("No target grid is set!"); return;}
this.p.gridid = gridid.indexOf("#") != -1 ? gridid : "#"+gridid;
var gcolMod = $(this.p.gridid).jqGrid("getGridParam",'colModel');
if(gcolMod) {
if( this.p.gridModel === true) {
var thegrid = $(this.p.gridid)[0];
var sh;
// we should use the options search, edittype, editoptions
// additionally surl and defval can be added in grid colModel
$.each(gcolMod, function (i,n) {
var tmpFil = [];
this.search = this.search === false ? false : true;
if(this.editrules && this.editrules.searchhidden === true) {
sh = true;
} else {
if(this.hidden === true ) {
sh = false;
} else {
sh = true;
}
}
if( this.search === true && sh === true) {
if(self.p.gridNames===true) {
tmpFil.label = thegrid.p.colNames[i];
} else {
tmpFil.label = '';
}
tmpFil.name = this.name;
tmpFil.index = this.index || this.name;
// we support only text and selects, so all other to text
tmpFil.stype = this.edittype || 'text';
if(tmpFil.stype != 'select' ) {
tmpFil.stype = 'text';
}
tmpFil.defval = this.defval || '';
tmpFil.surl = this.surl || '';
tmpFil.sopt = this.editoptions || {};
tmpFil.width = this.width;
self.p.filterModel.push(tmpFil);
}
});
} else {
$.each(self.p.filterModel,function(i,n) {
for(var j=0;j<gcolMod.length;j++) {
if(this.name == gcolMod[j].name) {
this.index = gcolMod[j].index || this.name;
break;
}
}
if(!this.index) {
this.index = this.name;
}
});
}
} else {
alert("Could not get grid colModel"); return;
}
var triggerSearch = function() {
var sdata={}, j=0, v;
var gr = $(self.p.gridid)[0], nm;
gr.p.searchdata = {};
if($.isFunction(self.p.beforeSearch)){self.p.beforeSearch();}
$.each(self.p.filterModel,function(i,n){
nm = this.index;
switch (this.stype) {
case 'select' :
v = $("select[name="+nm+"]",self).val();
if(v) {
sdata[nm] = v;
if(self.p.marksearched){
$("#jqgh_"+this.name,gr.grid.hDiv).addClass("dirty-cell");
}
j++;
} else {
if(self.p.marksearched){
$("#jqgh_"+this.name,gr.grid.hDiv).removeClass("dirty-cell");
}
try {
delete gr.p.postData[this.index];
} catch (e) {}
}
break;
default:
v = $("input[name="+nm+"]",self).val();
if(v) {
sdata[nm] = v;
if(self.p.marksearched){
$("#jqgh_"+this.name,gr.grid.hDiv).addClass("dirty-cell");
}
j++;
} else {
if(self.p.marksearched){
$("#jqgh_"+this.name,gr.grid.hDiv).removeClass("dirty-cell");
}
try {
delete gr.p.postData[this.index];
} catch(e) {}
}
}
});
var sd = j>0 ? true : false;
$.extend(gr.p.postData,sdata);
var saveurl;
if(self.p.url) {
saveurl = $(gr).jqGrid("getGridParam",'url');
$(gr).jqGrid("setGridParam",{url:self.p.url});
}
$(gr).jqGrid("setGridParam",{search:sd}).trigger("reloadGrid",[{page:1}]);
if(saveurl) {$(gr).jqGrid("setGridParam",{url:saveurl});}
if($.isFunction(self.p.afterSearch)){self.p.afterSearch();}
};
var clearSearch = function(){
var sdata={}, v, j=0;
var gr = $(self.p.gridid)[0], nm;
if($.isFunction(self.p.beforeClear)){self.p.beforeClear();}
$.each(self.p.filterModel,function(i,n){
nm = this.index;
v = (this.defval) ? this.defval : "";
if(!this.stype){this.stype='text';}
switch (this.stype) {
case 'select' :
var v1;
$("select[name="+nm+"] option",self).each(function (i){
if(i===0) { this.selected = true; }
if ($(this).text() == v) {
this.selected = true;
v1 = $(this).val();
return false;
}
});
if(v1) {
// post the key and not the text
sdata[nm] = v1;
if(self.p.marksearched){
$("#jqgh_"+this.name,gr.grid.hDiv).addClass("dirty-cell");
}
j++;
} else {
if(self.p.marksearched){
$("#jqgh_"+this.name,gr.grid.hDiv).removeClass("dirty-cell");
}
try {
delete gr.p.postData[this.index];
} catch (e) {}
}
break;
case 'text':
$("input[name="+nm+"]",self).val(v);
if(v) {
sdata[nm] = v;
if(self.p.marksearched){
$("#jqgh_"+this.name,gr.grid.hDiv).addClass("dirty-cell");
}
j++;
} else {
if(self.p.marksearched){
$("#jqgh_"+this.name,gr.grid.hDiv).removeClass("dirty-cell");
}
try {
delete gr.p.postData[this.index];
} catch (e) {}
}
break;
}
});
var sd = j>0 ? true : false;
$.extend(gr.p.postData,sdata);
var saveurl;
if(self.p.url) {
saveurl = $(gr).jqGrid("getGridParam",'url');
$(gr).jqGrid("setGridParam",{url:self.p.url});
}
$(gr).jqGrid("setGridParam",{search:sd}).trigger("reloadGrid",[{page:1}]);
if(saveurl) {$(gr).jqGrid("setGridParam",{url:saveurl});}
if($.isFunction(self.p.afterClear)){self.p.afterClear();}
};
var tbl;
var formFill = function(){
var tr = document.createElement("tr");
var tr1, sb, cb,tl,td;
if(self.p.formtype=='horizontal'){
$(tbl).append(tr);
}
$.each(self.p.filterModel,function(i,n){
tl = document.createElement("td");
$(tl).append("<label for='"+this.name+"'>"+this.label+"</label>");
td = document.createElement("td");
var $t=this;
if(!this.stype) { this.stype='text';}
switch (this.stype)
{
case "select":
if(this.surl) {
// data returned should have already constructed html select
$(td).load(this.surl,function(){
if($t.defval) { $("select",this).val($t.defval); }
$("select",this).attr({name:$t.index || $t.name, id: "sg_"+$t.name});
if($t.sopt) { $("select",this).attr($t.sopt); }
if(self.p.gridToolbar===true && $t.width) {
$("select",this).width($t.width);
}
if(self.p.autosearch===true){
$("select",this).change(function(e){
triggerSearch();
return false;
});
}
});
} else {
// sopt to construct the values
if($t.sopt.value) {
var oSv = $t.sopt.value;
var elem = document.createElement("select");
$(elem).attr({name:$t.index || $t.name, id: "sg_"+$t.name}).attr($t.sopt);
var so, sv, ov;
if(typeof oSv === "string") {
so = oSv.split(";");
for(var k=0; k<so.length;k++){
sv = so[k].split(":");
ov = document.createElement("option");
ov.value = sv[0]; ov.innerHTML = sv[1];
if (sv[1]==$t.defval) { ov.selected ="selected"; }
elem.appendChild(ov);
}
} else if(typeof oSv === "object" ) {
for ( var key in oSv) {
if(oSv.hasOwnProperty(key)) {
i++;
ov = document.createElement("option");
ov.value = key; ov.innerHTML = oSv[key];
if (oSv[key]==$t.defval) { ov.selected ="selected"; }
elem.appendChild(ov);
}
}
}
if(self.p.gridToolbar===true && $t.width) {
$(elem).width($t.width);
}
$(td).append(elem);
if(self.p.autosearch===true){
$(elem).change(function(e){
triggerSearch();
return false;
});
}
}
}
break;
case 'text':
var df = this.defval ? this.defval: "";
$(td).append("<input type='text' name='"+(this.index || this.name)+"' id='sg_"+this.name+"' value='"+df+"'/>");
if($t.sopt) { $("input",td).attr($t.sopt); }
if(self.p.gridToolbar===true && $t.width) {
if($.browser.msie) {
$("input",td).width($t.width-4);
} else {
$("input",td).width($t.width-2);
}
}
if(self.p.autosearch===true){
$("input",td).keypress(function(e){
var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;
if(key == 13){
triggerSearch();
return false;
}
return this;
});
}
break;
}
if(self.p.formtype=='horizontal'){
if(self.p.gridToolbar===true && self.p.gridNames===false) {
$(tr).append(td);
} else {
$(tr).append(tl).append(td);
}
$(tr).append(td);
} else {
tr1 = document.createElement("tr");
$(tr1).append(tl).append(td);
$(tbl).append(tr1);
}
});
td = document.createElement("td");
if(self.p.enableSearch === true){
sb = "<input type='button' id='sButton' class='"+self.p.buttonclass+"' value='"+self.p.searchButton+"'/>";
$(td).append(sb);
$("input#sButton",td).click(function(){
triggerSearch();
return false;
});
}
if(self.p.enableClear === true) {
cb = "<input type='button' id='cButton' class='"+self.p.buttonclass+"' value='"+self.p.clearButton+"'/>";
$(td).append(cb);
$("input#cButton",td).click(function(){
clearSearch();
return false;
});
}
if(self.p.enableClear === true || self.p.enableSearch === true) {
if(self.p.formtype=='horizontal') {
$(tr).append(td);
} else {
tr1 = document.createElement("tr");
$(tr1).append("<td> </td>").append(td);
$(tbl).append(tr1);
}
}
};
var frm = $("<form name='SearchForm' style=display:inline;' class='"+this.p.formclass+"'></form>");
tbl =$("<table class='"+this.p.tableclass+"' cellspacing='0' cellpading='0' border='0'><tbody></tbody></table>");
$(frm).append(tbl);
formFill();
$(this).append(frm);
this.triggerSearch = triggerSearch;
this.clearSearch = clearSearch;
});
},
filterToolbar : function(p){
p = $.extend({
autosearch: true,
searchOnEnter : true,
beforeSearch: null,
afterSearch: null,
beforeClear: null,
afterClear: null,
searchurl : '',
stringResult: false,
groupOp: 'AND',
defaultSearch : "bw"
},p || {});
return this.each(function(){
var $t = this;
var triggerToolbar = function() {
var sdata={}, j=0, v, nm, sopt={},so;
$.each($t.p.colModel,function(i,n){
nm = this.index || this.name;
switch (this.stype) {
case 'select' :
so = (this.searchoptions && this.searchoptions.sopt) ? this.searchoptions.sopt[0] : 'eq';
v = $("select[name="+nm+"]",$t.grid.hDiv).val();
if(v) {
sdata[nm] = v;
sopt[nm] = so;
j++;
} else {
try {
delete $t.p.postData[nm];
} catch (e) {}
}
break;
case 'text':
so = (this.searchoptions && this.searchoptions.sopt) ? this.searchoptions.sopt[0] : p.defaultSearch;
v = $("input[name="+nm+"]",$t.grid.hDiv).val();
if(v) {
sdata[nm] = v;
sopt[nm] = so;
j++;
} else {
try {
delete $t.p.postData[nm];
} catch (e) {}
}
break;
}
});
var sd = j>0 ? true : false;
if(p.stringResult === true || $t.p.datatype == "local") {
var ruleGroup = "{\"groupOp\":\"" + p.groupOp + "\",\"rules\":[";
var gi=0;
$.each(sdata,function(i,n){
if (gi > 0) {ruleGroup += ",";}
ruleGroup += "{\"field\":\"" + i + "\",";
ruleGroup += "\"op\":\"" + sopt[i] + "\",";
ruleGroup += "\"data\":\"" + n + "\"}";
gi++;
});
ruleGroup += "]}";
$.extend($t.p.postData,{filters:ruleGroup});
} else {
$.extend($t.p.postData,sdata);
}
var saveurl;
if($t.p.searchurl) {
saveurl = $t.p.url;
$($t).jqGrid("setGridParam",{url:$t.p.searchurl});
}
var bsr = false;
if($.isFunction(p.beforeSearch)){bsr = p.beforeSearch.call($t);}
if(!bsr) { $($t).jqGrid("setGridParam",{search:sd}).trigger("reloadGrid",[{page:1}]); }
if(saveurl) {$($t).jqGrid("setGridParam",{url:saveurl});}
if($.isFunction(p.afterSearch)){p.afterSearch();}
};
var clearToolbar = function(trigger){
var sdata={}, v, j=0, nm;
trigger = (typeof trigger != 'boolean') ? true : trigger;
$.each($t.p.colModel,function(i,n){
v = (this.searchoptions && this.searchoptions.defaultValue) ? this.searchoptions.defaultValue : "";
nm = this.index || this.name;
switch (this.stype) {
case 'select' :
var v1;
$("select[name="+nm+"] option",$t.grid.hDiv).each(function (i){
if(i===0) { this.selected = true; }
if ($(this).text() == v) {
this.selected = true;
v1 = $(this).val();
return false;
}
});
if (v1) {
// post the key and not the text
sdata[nm] = v1;
j++;
} else {
try {
delete $t.p.postData[nm];
} catch(e) {}
}
break;
case 'text':
$("input[name="+nm+"]",$t.grid.hDiv).val(v);
if(v) {
sdata[nm] = v;
j++;
} else {
try {
delete $t.p.postData[nm];
} catch (e){}
}
break;
}
});
var sd = j>0 ? true : false;
if(p.stringResult === true || $t.p.datatype == "local") {
var ruleGroup = "{\"groupOp\":\"" + p.groupOp + "\",\"rules\":[";
var gi=0;
$.each(sdata,function(i,n){
if (gi > 0) {ruleGroup += ",";}
ruleGroup += "{\"field\":\"" + i + "\",";
ruleGroup += "\"op\":\"" + "eq" + "\",";
ruleGroup += "\"data\":\"" + n + "\"}";
gi++;
});
ruleGroup += "]}";
$.extend($t.p.postData,{filters:ruleGroup});
} else {
$.extend($t.p.postData,sdata);
}
var saveurl;
if($t.p.searchurl) {
saveurl = $t.p.url;
$($t).jqGrid("setGridParam",{url:$t.p.searchurl});
}
var bcv = false;
if($.isFunction(p.beforeClear)){bcv = p.beforeClear.call($t);}
if(!bcv) {
if(trigger) {
$($t).jqGrid("setGridParam",{search:sd}).trigger("reloadGrid",[{page:1}]);
}
}
if(saveurl) {$($t).jqGrid("setGridParam",{url:saveurl});}
if($.isFunction(p.afterClear)){p.afterClear();}
};
var toggleToolbar = function(){
var trow = $("tr.ui-search-toolbar",$t.grid.hDiv);
if(trow.css("display")=='none') { trow.show(); }
else { trow.hide(); }
};
// create the row
function bindEvents(selector, events) {
var jElem = $(selector);
if (jElem[0]) {
jQuery.each(events, function() {
if (this.data !== undefined) {
jElem.bind(this.type, this.data, this.fn);
} else {
jElem.bind(this.type, this.fn);
}
});
}
}
var tr = $("<tr class='ui-search-toolbar' role='rowheader'></tr>");
var timeoutHnd;
$.each($t.p.colModel,function(i,n){
var cm=this, thd , th, soptions,surl,self;
th = $("<th role='columnheader' class='ui-state-default ui-th-column ui-th-"+$t.p.direction+"'></th>");
thd = $("<div style='width:100%;position:relative;height:100%;padding-right:0.3em;'></div>");
if(this.hidden===true) { $(th).css("display","none");}
this.search = this.search === false ? false : true;
if(typeof this.stype == 'undefined' ) {this.stype='text';}
soptions = $.extend({},this.searchoptions || {});
if(this.search){
switch (this.stype)
{
case "select":
surl = this.surl || soptions.dataUrl;
if(surl) {
// data returned should have already constructed html select
// primitive jQuery load
self = thd;
$.ajax($.extend({
url: surl,
dataType: "html",
complete: function(res,status) {
if(soptions.buildSelect !== undefined) {
var d = soptions.buildSelect(res);
if (d) { $(self).append(d); }
} else {
$(self).append(res.responseText);
}
if(soptions.defaultValue) { $("select",self).val(soptions.defaultValue); }
$("select",self).attr({name:cm.index || cm.name, id: "gs_"+cm.name});
if(soptions.attr) {$("select",self).attr(soptions.attr);}
$("select",self).css({width: "100%"});
// preserve autoserch
if(soptions.dataInit !== undefined) { soptions.dataInit($("select",self)[0]); }
if(soptions.dataEvents !== undefined) { bindEvents($("select",self)[0],soptions.dataEvents); }
if(p.autosearch===true){
$("select",self).change(function(e){
triggerToolbar();
return false;
});
}
res=null;
}
}, $.jgrid.ajaxOptions, $t.p.ajaxSelectOptions || {} ));
} else {
var oSv;
if(cm.searchoptions && cm.searchoptions.value) {
oSv = cm.searchoptions.value;
} else if(cm.editoptions && cm.editoptions.value) {
oSv = cm.editoptions.value;
}
if (oSv) {
var elem = document.createElement("select");
elem.style.width = "100%";
$(elem).attr({name:cm.index || cm.name, id: "gs_"+cm.name});
var so, sv, ov;
if(typeof oSv === "string") {
so = oSv.split(";");
for(var k=0; k<so.length;k++){
sv = so[k].split(":");
ov = document.createElement("option");
ov.value = sv[0]; ov.innerHTML = sv[1];
elem.appendChild(ov);
}
} else if(typeof oSv === "object" ) {
for ( var key in oSv) {
if(oSv.hasOwnProperty(key)) {
ov = document.createElement("option");
ov.value = key; ov.innerHTML = oSv[key];
elem.appendChild(ov);
}
}
}
if(soptions.defaultValue) { $(elem).val(soptions.defaultValue); }
if(soptions.attr) {$(elem).attr(soptions.attr);}
if(soptions.dataInit !== undefined) { soptions.dataInit(elem); }
if(soptions.dataEvents !== undefined) { bindEvents(elem, soptions.dataEvents); }
$(thd).append(elem);
if(p.autosearch===true){
$(elem).change(function(e){
triggerToolbar();
return false;
});
}
}
}
break;
case 'text':
var df = soptions.defaultValue ? soptions.defaultValue: "";
$(thd).append("<input type='text' style='width:95%;padding:0px;' name='"+(cm.index || cm.name)+"' id='gs_"+cm.name+"' value='"+df+"'/>");
if(soptions.attr) {$("input",thd).attr(soptions.attr);}
if(soptions.dataInit !== undefined) { soptions.dataInit($("input",thd)[0]); }
if(soptions.dataEvents !== undefined) { bindEvents($("input",thd)[0], soptions.dataEvents); }
if(p.autosearch===true){
if(p.searchOnEnter) {
$("input",thd).keypress(function(e){
var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;
if(key == 13){
triggerToolbar();
return false;
}
return this;
});
} else {
$("input",thd).keydown(function(e){
var key = e.which;
switch (key) {
case 13:
return false;
case 9 :
case 16:
case 37:
case 38:
case 39:
case 40:
case 27:
break;
default :
if(timeoutHnd) { clearTimeout(timeoutHnd); }
timeoutHnd = setTimeout(function(){triggerToolbar();},500);
}
});
}
}
break;
}
}
$(th).append(thd);
$(tr).append(th);
});
$("table thead",$t.grid.hDiv).append(tr);
this.triggerToolbar = triggerToolbar;
this.clearToolbar = clearToolbar;
this.toggleToolbar = toggleToolbar;
});
}
});
})(jQuery); | zzh-simple-hr | ZJs/webapp/grid/jqgrid/3.8.2/src/grid.custom.js | JavaScript | art | 27,428 |
;(function($){
/*
**
* jqGrid addons using jQuery UI
* Author: Mark Williams
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl-2.0.html
* depends on jQuery UI
**/
if ($.browser.msie && $.browser.version==8) {
$.expr[":"].hidden = function(elem) {
return elem.offsetWidth === 0 || elem.offsetHeight === 0 ||
elem.style.display == "none";
};
}
// requiere load multiselect before grid
$.jgrid._multiselect = false;
if($.ui) {
if ($.ui.multiselect ) {
if($.ui.multiselect.prototype._setSelected) {
var setSelected = $.ui.multiselect.prototype._setSelected;
$.ui.multiselect.prototype._setSelected = function(item,selected) {
var ret = setSelected.call(this,item,selected);
if (selected && this.selectedList) {
var elt = this.element;
this.selectedList.find('li').each(function() {
if ($(this).data('optionLink')) {
$(this).data('optionLink').remove().appendTo(elt);
}
});
}
return ret;
};
}
if($.ui.multiselect.prototype.destroy) {
$.ui.multiselect.prototype.destroy = function() {
this.element.show();
this.container.remove();
if ($.Widget === undefined) {
$.widget.prototype.destroy.apply(this, arguments);
} else {
$.Widget.prototype.destroy.apply(this, arguments);
}
};
}
$.jgrid._multiselect = true;
}
}
$.jgrid.extend({
sortableColumns : function (tblrow)
{
return this.each(function (){
var ts = this;
function start() {ts.p.disableClick = true;}
var sortable_opts = {
"tolerance" : "pointer",
"axis" : "x",
"scrollSensitivity": "1",
"items": '>th:not(:has(#jqgh_cb,#jqgh_rn,#jqgh_subgrid),:hidden)',
"placeholder": {
element: function(item) {
var el = $(document.createElement(item[0].nodeName))
.addClass(item[0].className+" ui-sortable-placeholder ui-state-highlight")
.removeClass("ui-sortable-helper")[0];
return el;
},
update: function(self, p) {
p.height(self.currentItem.innerHeight() - parseInt(self.currentItem.css('paddingTop')||0, 10) - parseInt(self.currentItem.css('paddingBottom')||0, 10));
p.width(self.currentItem.innerWidth() - parseInt(self.currentItem.css('paddingLeft')||0, 10) - parseInt(self.currentItem.css('paddingRight')||0, 10));
}
},
"update": function(event, ui) {
var p = $(ui.item).parent();
var th = $(">th", p);
var colModel = ts.p.colModel;
var cmMap = {};
$.each(colModel, function(i) { cmMap[this.name]=i; });
var permutation = [];
th.each(function(i) {
var id = $(">div", this).get(0).id.replace(/^jqgh_/, "");
if (id in cmMap) {
permutation.push(cmMap[id]);
}
});
$(ts).jqGrid("remapColumns",permutation, true, true);
if ($.isFunction(ts.p.sortable.update)) {
ts.p.sortable.update(permutation);
}
setTimeout(function(){ts.p.disableClick=false;}, 50);
}
};
if (ts.p.sortable.options) {
$.extend(sortable_opts, ts.p.sortable.options);
} else if ($.isFunction(ts.p.sortable)) {
ts.p.sortable = { "update" : ts.p.sortable };
}
if (sortable_opts.start) {
var s = sortable_opts.start;
sortable_opts.start = function(e,ui) {
start();
s.call(this,e,ui);
};
} else {
sortable_opts.start = start;
}
if (ts.p.sortable.exclude) {
sortable_opts.items += ":not("+ts.p.sortable.exclude+")";
}
tblrow.sortable(sortable_opts).data("sortable").floating = true;
});
},
columnChooser : function(opts) {
var self = this;
if($("#colchooser_"+self[0].p.id).length ) { return; }
var selector = $('<div id="colchooser_'+self[0].p.id+'" style="position:relative;overflow:hidden"><div><select multiple="multiple"></select></div></div>');
var select = $('select', selector);
function insert(perm,i,v) {
if(i>=0){
var a = perm.slice();
var b = a.splice(i,Math.max(perm.length-i,i));
if(i>perm.length) { i = perm.length; }
a[i] = v;
return a.concat(b);
}
}
opts = $.extend({
"width" : 420,
"height" : 240,
"classname" : null,
"done" : function(perm) { if (perm) { self.jqGrid("remapColumns", perm, true); } },
/* msel is either the name of a ui widget class that
extends a multiselect, or a function that supports
creating a multiselect object (with no argument,
or when passed an object), and destroying it (when
passed the string "destroy"). */
"msel" : "multiselect",
/* "msel_opts" : {}, */
/* dlog is either the name of a ui widget class that
behaves in a dialog-like way, or a function, that
supports creating a dialog (when passed dlog_opts)
or destroying a dialog (when passed the string
"destroy")
*/
"dlog" : "dialog",
/* dlog_opts is either an option object to be passed
to "dlog", or (more likely) a function that creates
the options object.
The default produces a suitable options object for
ui.dialog */
"dlog_opts" : function(opts) {
var buttons = {};
buttons[opts.bSubmit] = function() {
opts.apply_perm();
opts.cleanup(false);
};
buttons[opts.bCancel] = function() {
opts.cleanup(true);
};
return {
"buttons": buttons,
"close": function() {
opts.cleanup(true);
},
"modal" : false,
"resizable": false,
"width": opts.width+20
};
},
/* Function to get the permutation array, and pass it to the
"done" function */
"apply_perm" : function() {
$('option',select).each(function(i) {
if (this.selected) {
self.jqGrid("showCol", colModel[this.value].name);
} else {
self.jqGrid("hideCol", colModel[this.value].name);
}
});
var perm = [];
//fixedCols.slice(0);
$('option[selected]',select).each(function() { perm.push(parseInt(this.value,10)); });
$.each(perm, function() { delete colMap[colModel[parseInt(this,10)].name]; });
$.each(colMap, function() {
var ti = parseInt(this,10);
perm = insert(perm,ti,ti);
});
if (opts.done) {
opts.done.call(self, perm);
}
},
/* Function to cleanup the dialog, and select. Also calls the
done function with no permutation (to indicate that the
columnChooser was aborted */
"cleanup" : function(calldone) {
call(opts.dlog, selector, 'destroy');
call(opts.msel, select, 'destroy');
selector.remove();
if (calldone && opts.done) {
opts.done.call(self);
}
},
"msel_opts" : {}
}, $.jgrid.col, opts || {});
if($.ui) {
if ($.ui.multiselect ) {
if(opts.msel == "multiselect") {
if(!$.jgrid._multiselect) {
// should be in language file
alert("Multiselect plugin loaded after jqGrid. Please load the plugin before the jqGrid!");
return;
}
opts.msel_opts = $.extend($.ui.multiselect.defaults,opts.msel_opts);
}
}
}
if (opts.caption) {
selector.attr("title", opts.caption);
}
if (opts.classname) {
selector.addClass(opts.classname);
select.addClass(opts.classname);
}
if (opts.width) {
$(">div",selector).css({"width": opts.width,"margin":"0 auto"});
select.css("width", opts.width);
}
if (opts.height) {
$(">div",selector).css("height", opts.height);
select.css("height", opts.height - 10);
}
var colModel = self.jqGrid("getGridParam", "colModel");
var colNames = self.jqGrid("getGridParam", "colNames");
var colMap = {}, fixedCols = [];
select.empty();
$.each(colModel, function(i) {
colMap[this.name] = i;
if (this.hidedlg) {
if (!this.hidden) {
fixedCols.push(i);
}
return;
}
select.append("<option value='"+i+"' "+
(this.hidden?"":"selected='selected'")+">"+colNames[i]+"</option>");
});
function call(fn, obj) {
if (!fn) { return; }
if (typeof fn == 'string') {
if ($.fn[fn]) {
$.fn[fn].apply(obj, $.makeArray(arguments).slice(2));
}
} else if ($.isFunction(fn)) {
fn.apply(obj, $.makeArray(arguments).slice(2));
}
}
var dopts = $.isFunction(opts.dlog_opts) ? opts.dlog_opts.call(self, opts) : opts.dlog_opts;
call(opts.dlog, selector, dopts);
var mopts = $.isFunction(opts.msel_opts) ? opts.msel_opts.call(self, opts) : opts.msel_opts;
call(opts.msel, select, mopts);
},
sortableRows : function (opts) {
// Can accept all sortable options and events
return this.each(function(){
var $t = this;
if(!$t.grid) { return; }
// Currently we disable a treeGrid sortable
if($t.p.treeGrid) { return; }
if($.fn.sortable) {
opts = $.extend({
"cursor":"move",
"axis" : "y",
"items": ".jqgrow"
},
opts || {});
if(opts.start && $.isFunction(opts.start)) {
opts._start_ = opts.start;
delete opts.start;
} else {opts._start_=false;}
if(opts.update && $.isFunction(opts.update)) {
opts._update_ = opts.update;
delete opts.update;
} else {opts._update_ = false;}
opts.start = function(ev,ui) {
$(ui.item).css("border-width","0px");
$("td",ui.item).each(function(i){
this.style.width = $t.grid.cols[i].style.width;
});
if($t.p.subGrid) {
var subgid = $(ui.item).attr("id");
try {
$($t).jqGrid('collapseSubGridRow',subgid);
} catch (e) {}
}
if(opts._start_) {
opts._start_.apply(this,[ev,ui]);
}
};
opts.update = function (ev,ui) {
$(ui.item).css("border-width","");
if($t.p.rownumbers === true) {
$("td.jqgrid-rownum",$t.rows).each(function(i){
$(this).html(i+1);
});
}
if(opts._update_) {
opts._update_.apply(this,[ev,ui]);
}
};
$("tbody:first",$t).sortable(opts);
$("tbody:first",$t).disableSelection();
}
});
},
gridDnD : function(opts) {
return this.each(function(){
var $t = this;
if(!$t.grid) { return; }
// Currently we disable a treeGrid drag and drop
if($t.p.treeGrid) { return; }
if(!$.fn.draggable || !$.fn.droppable) { return; }
function updateDnD ()
{
var datadnd = $.data($t,"dnd");
$("tr.jqgrow:not(.ui-draggable)",$t).draggable($.isFunction(datadnd.drag) ? datadnd.drag.call($($t),datadnd) : datadnd.drag);
}
var appender = "<table id='jqgrid_dnd' class='ui-jqgrid-dnd'></table>";
if($("#jqgrid_dnd").html() === null) {
$('body').append(appender);
}
if(typeof opts == 'string' && opts == 'updateDnD' && $t.p.jqgdnd===true) {
updateDnD();
return;
}
opts = $.extend({
"drag" : function (opts) {
return $.extend({
start : function (ev, ui) {
// if we are in subgrid mode try to collapse the node
if($t.p.subGrid) {
var subgid = $(ui.helper).attr("id");
try {
$($t).jqGrid('collapseSubGridRow',subgid);
} catch (e) {}
}
// hack
// drag and drop does not insert tr in table, when the table has no rows
// we try to insert new empty row on the target(s)
for (var i=0;i<$.data($t,"dnd").connectWith.length;i++){
if($($.data($t,"dnd").connectWith[i]).jqGrid('getGridParam','reccount') == "0" ){
$($.data($t,"dnd").connectWith[i]).jqGrid('addRowData','jqg_empty_row',{});
}
}
ui.helper.addClass("ui-state-highlight");
$("td",ui.helper).each(function(i) {
this.style.width = $t.grid.headers[i].width+"px";
});
if(opts.onstart && $.isFunction(opts.onstart) ) { opts.onstart.call($($t),ev,ui); }
},
stop :function(ev,ui) {
if(ui.helper.dropped) {
var ids = $(ui.helper).attr("id");
$($t).jqGrid('delRowData',ids );
}
// if we have a empty row inserted from start event try to delete it
for (var i=0;i<$.data($t,"dnd").connectWith.length;i++){
$($.data($t,"dnd").connectWith[i]).jqGrid('delRowData','jqg_empty_row');
}
if(opts.onstop && $.isFunction(opts.onstop) ) { opts.onstop.call($($t),ev,ui); }
}
},opts.drag_opts || {});
},
"drop" : function (opts) {
return $.extend({
accept: function(d) {
if (!$(d).hasClass('jqgrow')) { return d;}
var tid = $(d).closest("table.ui-jqgrid-btable");
if(tid.length > 0 && $.data(tid[0],"dnd") !== undefined) {
var cn = $.data(tid[0],"dnd").connectWith;
return $.inArray('#'+this.id,cn) != -1 ? true : false;
}
return d;
},
drop: function(ev, ui) {
if (!$(ui.draggable).hasClass('jqgrow')) { return; }
var accept = $(ui.draggable).attr("id");
var getdata = ui.draggable.parent().parent().jqGrid('getRowData',accept);
if(!opts.dropbyname) {
var j =0, tmpdata = {}, dropname;
var dropmodel = $("#"+this.id).jqGrid('getGridParam','colModel');
try {
for (var key in getdata) {
if(getdata.hasOwnProperty(key) && dropmodel[j]) {
dropname = dropmodel[j].name;
tmpdata[dropname] = getdata[key];
}
j++;
}
getdata = tmpdata;
} catch (e) {}
}
ui.helper.dropped = true;
if(opts.beforedrop && $.isFunction(opts.beforedrop) ) {
//parameters to this callback - event, element, data to be inserted, sender, reciever
// should return object which will be inserted into the reciever
var datatoinsert = opts.beforedrop.call(this,ev,ui,getdata,$('#'+$t.id),$(this));
if (typeof datatoinsert != "undefined" && datatoinsert !== null && typeof datatoinsert == "object") { getdata = datatoinsert; }
}
if(ui.helper.dropped) {
var grid;
if(opts.autoid) {
if($.isFunction(opts.autoid)) {
grid = opts.autoid.call(this,getdata);
} else {
grid = Math.ceil(Math.random()*1000);
grid = opts.autoidprefix+grid;
}
}
// NULL is interpreted as undefined while null as object
$("#"+this.id).jqGrid('addRowData',grid,getdata,opts.droppos);
}
if(opts.ondrop && $.isFunction(opts.ondrop) ) { opts.ondrop.call(this,ev,ui, getdata); }
}}, opts.drop_opts || {});
},
"onstart" : null,
"onstop" : null,
"beforedrop": null,
"ondrop" : null,
"drop_opts" : {
"activeClass": "ui-state-active",
"hoverClass": "ui-state-hover"
},
"drag_opts" : {
"revert": "invalid",
"helper": "clone",
"cursor": "move",
"appendTo" : "#jqgrid_dnd",
"zIndex": 5000
},
"dropbyname" : false,
"droppos" : "first",
"autoid" : true,
"autoidprefix" : "dnd_"
}, opts || {});
if(!opts.connectWith) { return; }
opts.connectWith = opts.connectWith.split(",");
opts.connectWith = $.map(opts.connectWith,function(n){return $.trim(n);});
$.data($t,"dnd",opts);
if($t.p.reccount != "0" && !$t.p.jqgdnd) {
updateDnD();
}
$t.p.jqgdnd = true;
for (var i=0;i<opts.connectWith.length;i++){
var cn =opts.connectWith[i];
$(cn).droppable($.isFunction(opts.drop) ? opts.drop.call($($t),opts) : opts.drop);
}
});
},
gridResize : function(opts) {
return this.each(function(){
var $t = this;
if(!$t.grid || !$.fn.resizable) { return; }
opts = $.extend({}, opts || {});
if(opts.alsoResize ) {
opts._alsoResize_ = opts.alsoResize;
delete opts.alsoResize;
} else {
opts._alsoResize_ = false;
}
if(opts.stop && $.isFunction(opts.stop)) {
opts._stop_ = opts.stop;
delete opts.stop;
} else {
opts._stop_ = false;
}
opts.stop = function (ev, ui) {
$($t).jqGrid('setGridParam',{height:$("#gview_"+$t.p.id+" .ui-jqgrid-bdiv").height()});
$($t).jqGrid('setGridWidth',ui.size.width,opts.shrinkToFit);
if(opts._stop_) { opts._stop_.call($t,ev,ui); }
};
if(opts._alsoResize_) {
var optstest = "{\'#gview_"+$t.p.id+" .ui-jqgrid-bdiv\':true,'" +opts._alsoResize_+"':true}";
opts.alsoResize = eval('('+optstest+')'); // the only way that I found to do this
} else {
opts.alsoResize = $(".ui-jqgrid-bdiv","#gview_"+$t.p.id);
}
delete opts._alsoResize_;
$("#gbox_"+$t.p.id).resizable(opts);
});
}
});
})(jQuery);
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/3.8.2/src/grid.jqueryui.js | JavaScript | art | 17,887 |
/*
* jQuery UI Multiselect
*
* Authors:
* Michael Aufreiter (quasipartikel.at)
* Yanick Rochon (yanick.rochon[at]gmail[dot]com)
*
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://www.quasipartikel.at/multiselect/
*
*
* Depends:
* ui.core.js
* ui.sortable.js
*
* Optional:
* localization (http://plugins.jquery.com/project/localisation)
* scrollTo (http://plugins.jquery.com/project/ScrollTo)
*
* Todo:
* Make batch actions faster
* Implement dynamic insertion through remote calls
*/
(function($) {
$.widget("ui.multiselect", {
_init: function() {
this.element.hide();
this.id = this.element.attr("id");
this.container = $('<div class="ui-multiselect ui-helper-clearfix ui-widget"></div>').insertAfter(this.element);
this.count = 0; // number of currently selected options
this.selectedContainer = $('<div class="selected"></div>').appendTo(this.container);
this.availableContainer = $('<div class="available"></div>').appendTo(this.container);
this.selectedActions = $('<div class="actions ui-widget-header ui-helper-clearfix"><span class="count">0 '+$.ui.multiselect.locale.itemsCount+'</span><a href="#" class="remove-all">'+$.ui.multiselect.locale.removeAll+'</a></div>').appendTo(this.selectedContainer);
this.availableActions = $('<div class="actions ui-widget-header ui-helper-clearfix"><input type="text" class="search empty ui-widget-content ui-corner-all"/><a href="#" class="add-all">'+$.ui.multiselect.locale.addAll+'</a></div>').appendTo(this.availableContainer);
this.selectedList = $('<ul class="selected connected-list"><li class="ui-helper-hidden-accessible"></li></ul>').bind('selectstart', function(){return false;}).appendTo(this.selectedContainer);
this.availableList = $('<ul class="available connected-list"><li class="ui-helper-hidden-accessible"></li></ul>').bind('selectstart', function(){return false;}).appendTo(this.availableContainer);
var that = this;
// set dimensions
this.container.width(this.element.width()+1);
this.selectedContainer.width(Math.floor(this.element.width()*this.options.dividerLocation));
this.availableContainer.width(Math.floor(this.element.width()*(1-this.options.dividerLocation)));
// fix list height to match <option> depending on their individual header's heights
this.selectedList.height(Math.max(this.element.height()-this.selectedActions.height(),1));
this.availableList.height(Math.max(this.element.height()-this.availableActions.height(),1));
if ( !this.options.animated ) {
this.options.show = 'show';
this.options.hide = 'hide';
}
// init lists
this._populateLists(this.element.find('option'));
// make selection sortable
if (this.options.sortable) {
$("ul.selected").sortable({
placeholder: 'ui-state-highlight',
axis: 'y',
update: function(event, ui) {
// apply the new sort order to the original selectbox
that.selectedList.find('li').each(function() {
if ($(this).data('optionLink'))
$(this).data('optionLink').remove().appendTo(that.element);
});
},
receive: function(event, ui) {
ui.item.data('optionLink').attr('selected', true);
// increment count
that.count += 1;
that._updateCount();
// workaround, because there's no way to reference
// the new element, see http://dev.jqueryui.com/ticket/4303
that.selectedList.children('.ui-draggable').each(function() {
$(this).removeClass('ui-draggable');
$(this).data('optionLink', ui.item.data('optionLink'));
$(this).data('idx', ui.item.data('idx'));
that._applyItemState($(this), true);
});
// workaround according to http://dev.jqueryui.com/ticket/4088
setTimeout(function() { ui.item.remove(); }, 1);
}
});
}
// set up livesearch
if (this.options.searchable) {
this._registerSearchEvents(this.availableContainer.find('input.search'));
} else {
$('.search').hide();
}
// batch actions
$(".remove-all").click(function() {
that._populateLists(that.element.find('option').removeAttr('selected'));
return false;
});
$(".add-all").click(function() {
that._populateLists(that.element.find('option').attr('selected', 'selected'));
return false;
});
},
destroy: function() {
this.element.show();
this.container.remove();
$.widget.prototype.destroy.apply(this, arguments);
},
_populateLists: function(options) {
this.selectedList.children('.ui-element').remove();
this.availableList.children('.ui-element').remove();
this.count = 0;
var that = this;
var items = $(options.map(function(i) {
var item = that._getOptionNode(this).appendTo(this.selected ? that.selectedList : that.availableList).show();
if (this.selected) that.count += 1;
that._applyItemState(item, this.selected);
item.data('idx', i);
return item[0];
}));
// update count
this._updateCount();
},
_updateCount: function() {
this.selectedContainer.find('span.count').text(this.count+" "+$.ui.multiselect.locale.itemsCount);
},
_getOptionNode: function(option) {
option = $(option);
var node = $('<li class="ui-state-default ui-element" title="'+option.text()+'"><span class="ui-icon"/>'+option.text()+'<a href="#" class="action"><span class="ui-corner-all ui-icon"/></a></li>').hide();
node.data('optionLink', option);
return node;
},
// clones an item with associated data
// didn't find a smarter away around this
_cloneWithData: function(clonee) {
var clone = clonee.clone();
clone.data('optionLink', clonee.data('optionLink'));
clone.data('idx', clonee.data('idx'));
return clone;
},
_setSelected: function(item, selected) {
item.data('optionLink').attr('selected', selected);
if (selected) {
var selectedItem = this._cloneWithData(item);
item[this.options.hide](this.options.animated, function() { $(this).remove(); });
selectedItem.appendTo(this.selectedList).hide()[this.options.show](this.options.animated);
this._applyItemState(selectedItem, true);
return selectedItem;
} else {
// look for successor based on initial option index
var items = this.availableList.find('li'), comparator = this.options.nodeComparator;
var succ = null, i = item.data('idx'), direction = comparator(item, $(items[i]));
// TODO: test needed for dynamic list populating
if ( direction ) {
while (i>=0 && i<items.length) {
direction > 0 ? i++ : i--;
if ( direction != comparator(item, $(items[i])) ) {
// going up, go back one item down, otherwise leave as is
succ = items[direction > 0 ? i : i+1];
break;
}
}
} else {
succ = items[i];
}
var availableItem = this._cloneWithData(item);
succ ? availableItem.insertBefore($(succ)) : availableItem.appendTo(this.availableList);
item[this.options.hide](this.options.animated, function() { $(this).remove(); });
availableItem.hide()[this.options.show](this.options.animated);
this._applyItemState(availableItem, false);
return availableItem;
}
},
_applyItemState: function(item, selected) {
if (selected) {
if (this.options.sortable)
item.children('span').addClass('ui-icon-arrowthick-2-n-s').removeClass('ui-helper-hidden').addClass('ui-icon');
else
item.children('span').removeClass('ui-icon-arrowthick-2-n-s').addClass('ui-helper-hidden').removeClass('ui-icon');
item.find('a.action span').addClass('ui-icon-minus').removeClass('ui-icon-plus');
this._registerRemoveEvents(item.find('a.action'));
} else {
item.children('span').removeClass('ui-icon-arrowthick-2-n-s').addClass('ui-helper-hidden').removeClass('ui-icon');
item.find('a.action span').addClass('ui-icon-plus').removeClass('ui-icon-minus');
this._registerAddEvents(item.find('a.action'));
}
this._registerHoverEvents(item);
},
// taken from John Resig's liveUpdate script
_filter: function(list) {
var input = $(this);
var rows = list.children('li'),
cache = rows.map(function(){
return $(this).text().toLowerCase();
});
var term = $.trim(input.val().toLowerCase()), scores = [];
if (!term) {
rows.show();
} else {
rows.hide();
cache.each(function(i) {
if (this.indexOf(term)>-1) { scores.push(i); }
});
$.each(scores, function() {
$(rows[this]).show();
});
}
},
_registerHoverEvents: function(elements) {
elements.removeClass('ui-state-hover');
elements.mouseover(function() {
$(this).addClass('ui-state-hover');
});
elements.mouseout(function() {
$(this).removeClass('ui-state-hover');
});
},
_registerAddEvents: function(elements) {
var that = this;
elements.click(function() {
var item = that._setSelected($(this).parent(), true);
that.count += 1;
that._updateCount();
return false;
})
// make draggable
.each(function() {
$(this).parent().draggable({
connectToSortable: 'ul.selected',
helper: function() {
var selectedItem = that._cloneWithData($(this)).width($(this).width() - 50);
selectedItem.width($(this).width());
return selectedItem;
},
appendTo: '.ui-multiselect',
containment: '.ui-multiselect',
revert: 'invalid'
});
});
},
_registerRemoveEvents: function(elements) {
var that = this;
elements.click(function() {
that._setSelected($(this).parent(), false);
that.count -= 1;
that._updateCount();
return false;
});
},
_registerSearchEvents: function(input) {
var that = this;
input.focus(function() {
$(this).addClass('ui-state-active');
})
.blur(function() {
$(this).removeClass('ui-state-active');
})
.keypress(function(e) {
if (e.keyCode == 13)
return false;
})
.keyup(function() {
that._filter.apply(this, [that.availableList]);
});
}
});
$.extend($.ui.multiselect, {
defaults: {
sortable: true,
searchable: true,
animated: 'fast',
show: 'slideDown',
hide: 'slideUp',
dividerLocation: 0.6,
nodeComparator: function(node1,node2) {
var text1 = node1.text(),
text2 = node2.text();
return text1 == text2 ? 0 : (text1 < text2 ? -1 : 1);
}
},
locale: {
addAll:'Add all',
removeAll:'Remove all',
itemsCount:'items selected'
}
});
})(jQuery);
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/3.8.2/src/ui.multiselect.js | JavaScript | art | 10,263 |
/*
**
* formatter for values but most of the values if for jqGrid
* Some of this was inspired and based on how YUI does the table datagrid but in jQuery fashion
* we are trying to keep it as light as possible
* Joshua Burnett josh@9ci.com
* http://www.greenbill.com
*
* Changes from Tony Tomov tony@trirand.com
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl-2.0.html
*
**/
;(function($) {
$.fmatter = {};
//opts can be id:row id for the row, rowdata:the data for the row, colmodel:the column model for this column
//example {id:1234,}
$.extend($.fmatter,{
isBoolean : function(o) {
return typeof o === 'boolean';
},
isObject : function(o) {
return (o && (typeof o === 'object' || $.isFunction(o))) || false;
},
isString : function(o) {
return typeof o === 'string';
},
isNumber : function(o) {
return typeof o === 'number' && isFinite(o);
},
isNull : function(o) {
return o === null;
},
isUndefined : function(o) {
return typeof o === 'undefined';
},
isValue : function (o) {
return (this.isObject(o) || this.isString(o) || this.isNumber(o) || this.isBoolean(o));
},
isEmpty : function(o) {
if(!this.isString(o) && this.isValue(o)) {
return false;
}else if (!this.isValue(o)){
return true;
}
o = $.trim(o).replace(/\ \;/ig,'').replace(/\ \;/ig,'');
return o==="";
}
});
$.fn.fmatter = function(formatType, cellval, opts, rwd, act) {
// build main options before element iteration
var v=cellval;
opts = $.extend({}, $.jgrid.formatter, opts);
if ($.fn.fmatter[formatType]){
v = $.fn.fmatter[formatType](cellval, opts, rwd, act);
}
return v;
};
$.fmatter.util = {
// Taken from YAHOO utils
NumberFormat : function(nData,opts) {
if(!$.fmatter.isNumber(nData)) {
nData *= 1;
}
if($.fmatter.isNumber(nData)) {
var bNegative = (nData < 0);
var sOutput = nData + "";
var sDecimalSeparator = (opts.decimalSeparator) ? opts.decimalSeparator : ".";
var nDotIndex;
if($.fmatter.isNumber(opts.decimalPlaces)) {
// Round to the correct decimal place
var nDecimalPlaces = opts.decimalPlaces;
var nDecimal = Math.pow(10, nDecimalPlaces);
sOutput = Math.round(nData*nDecimal)/nDecimal + "";
nDotIndex = sOutput.lastIndexOf(".");
if(nDecimalPlaces > 0) {
// Add the decimal separator
if(nDotIndex < 0) {
sOutput += sDecimalSeparator;
nDotIndex = sOutput.length-1;
}
// Replace the "."
else if(sDecimalSeparator !== "."){
sOutput = sOutput.replace(".",sDecimalSeparator);
}
// Add missing zeros
while((sOutput.length - 1 - nDotIndex) < nDecimalPlaces) {
sOutput += "0";
}
}
}
if(opts.thousandsSeparator) {
var sThousandsSeparator = opts.thousandsSeparator;
nDotIndex = sOutput.lastIndexOf(sDecimalSeparator);
nDotIndex = (nDotIndex > -1) ? nDotIndex : sOutput.length;
var sNewOutput = sOutput.substring(nDotIndex);
var nCount = -1;
for (var i=nDotIndex; i>0; i--) {
nCount++;
if ((nCount%3 === 0) && (i !== nDotIndex) && (!bNegative || (i > 1))) {
sNewOutput = sThousandsSeparator + sNewOutput;
}
sNewOutput = sOutput.charAt(i-1) + sNewOutput;
}
sOutput = sNewOutput;
}
// Prepend prefix
sOutput = (opts.prefix) ? opts.prefix + sOutput : sOutput;
// Append suffix
sOutput = (opts.suffix) ? sOutput + opts.suffix : sOutput;
return sOutput;
} else {
return nData;
}
},
// Tony Tomov
// PHP implementation. Sorry not all options are supported.
// Feel free to add them if you want
DateFormat : function (format, date, newformat, opts) {
var token = /\\.|[dDjlNSwzWFmMntLoYyaABgGhHisueIOPTZcrU]/g,
timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,
timezoneClip = /[^-+\dA-Z]/g,
msDateRegExp = new RegExp("^/Date\((([-+])?[0-9]+)(([-+])([0-9]{2})([0-9]{2}))?\)/$"),
msMatch = date.match(msDateRegExp),
pad = function (value, length) {
value = String(value);
length = parseInt(length,10) || 2;
while (value.length < length) { value = '0' + value; }
return value;
},
ts = {m : 1, d : 1, y : 1970, h : 0, i : 0, s : 0, u:0},
timestamp=0, dM, k,hl,
dateFormat=["i18n"];
// Internationalization strings
dateFormat.i18n = {
dayNames: opts.dayNames,
monthNames: opts.monthNames
};
if( format in opts.masks ) { format = opts.masks[format]; }
if(date.constructor === Number) {
timestamp = new Date(date);
} else if(date.constructor === Date) {
timestamp = date;
// Microsoft date format support
} else if( msMatch !== null ) {
timestamp = new Date(parseInt(msMatch[1], 10));
if (msMatch[3]) {
var offset = Number(msMatch[5]) * 60 + Number(msMatch[6]);
offset *= ((msMatch[4] == '-') ? 1 : -1);
offset -= timestamp.getTimezoneOffset();
timestamp.setTime(Number(Number(timestamp) + (offset * 60 * 1000)));
}
} else {
date = date.split(/[\\\/:_;.,\t\T\s-]/);
format = format.split(/[\\\/:_;.,\t\T\s-]/);
// parsing for month names
for(k=0,hl=format.length;k<hl;k++){
if(format[k] == 'M') {
dM = $.inArray(date[k],dateFormat.i18n.monthNames);
if(dM !== -1 && dM < 12){date[k] = dM+1;}
}
if(format[k] == 'F') {
dM = $.inArray(date[k],dateFormat.i18n.monthNames);
if(dM !== -1 && dM > 11){date[k] = dM+1-12;}
}
if(date[k]) {
ts[format[k].toLowerCase()] = parseInt(date[k],10);
}
}
if(ts.f) { ts.m = ts.f; }
if( ts.m === 0 && ts.y === 0 && ts.d === 0) {
return " " ;
}
ts.m = parseInt(ts.m,10)-1;
var ty = ts.y;
if (ty >= 70 && ty <= 99) { ts.y = 1900+ts.y; }
else if (ty >=0 && ty <=69) { ts.y= 2000+ts.y; }
timestamp = new Date(ts.y, ts.m, ts.d, ts.h, ts.i, ts.s, ts.u);
}
if( newformat in opts.masks ) {
newformat = opts.masks[newformat];
} else if ( !newformat ) {
newformat = 'Y-m-d';
}
var
G = timestamp.getHours(),
i = timestamp.getMinutes(),
j = timestamp.getDate(),
n = timestamp.getMonth() + 1,
o = timestamp.getTimezoneOffset(),
s = timestamp.getSeconds(),
u = timestamp.getMilliseconds(),
w = timestamp.getDay(),
Y = timestamp.getFullYear(),
N = (w + 6) % 7 + 1,
z = (new Date(Y, n - 1, j) - new Date(Y, 0, 1)) / 86400000,
flags = {
// Day
d: pad(j),
D: dateFormat.i18n.dayNames[w],
j: j,
l: dateFormat.i18n.dayNames[w + 7],
N: N,
S: opts.S(j),
//j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th',
w: w,
z: z,
// Week
W: N < 5 ? Math.floor((z + N - 1) / 7) + 1 : Math.floor((z + N - 1) / 7) || ((new Date(Y - 1, 0, 1).getDay() + 6) % 7 < 4 ? 53 : 52),
// Month
F: dateFormat.i18n.monthNames[n - 1 + 12],
m: pad(n),
M: dateFormat.i18n.monthNames[n - 1],
n: n,
t: '?',
// Year
L: '?',
o: '?',
Y: Y,
y: String(Y).substring(2),
// Time
a: G < 12 ? opts.AmPm[0] : opts.AmPm[1],
A: G < 12 ? opts.AmPm[2] : opts.AmPm[3],
B: '?',
g: G % 12 || 12,
G: G,
h: pad(G % 12 || 12),
H: pad(G),
i: pad(i),
s: pad(s),
u: u,
// Timezone
e: '?',
I: '?',
O: (o > 0 ? "-" : "+") + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4),
P: '?',
T: (String(timestamp).match(timezone) || [""]).pop().replace(timezoneClip, ""),
Z: '?',
// Full Date/Time
c: '?',
r: '?',
U: Math.floor(timestamp / 1000)
};
return newformat.replace(token, function ($0) {
return $0 in flags ? flags[$0] : $0.substring(1);
});
}
};
$.fn.fmatter.defaultFormat = function(cellval, opts) {
return ($.fmatter.isValue(cellval) && cellval!=="" ) ? cellval : opts.defaultValue ? opts.defaultValue : " ";
};
$.fn.fmatter.email = function(cellval, opts) {
if(!$.fmatter.isEmpty(cellval)) {
return "<a href=\"mailto:" + cellval + "\">" + cellval + "</a>";
}else {
return $.fn.fmatter.defaultFormat(cellval,opts );
}
};
$.fn.fmatter.checkbox =function(cval, opts) {
var op = $.extend({},opts.checkbox), ds;
if(!$.fmatter.isUndefined(opts.colModel.formatoptions)) {
op = $.extend({},op,opts.colModel.formatoptions);
}
if(op.disabled===true) {ds = "disabled=\"disabled\"";} else {ds="";}
if($.fmatter.isEmpty(cval) || $.fmatter.isUndefined(cval) ) { cval = $.fn.fmatter.defaultFormat(cval,op); }
cval=cval+""; cval=cval.toLowerCase();
var bchk = cval.search(/(false|0|no|off)/i)<0 ? " checked='checked' " : "";
return "<input type=\"checkbox\" " + bchk + " value=\""+ cval+"\" offval=\"no\" "+ds+ "/>";
};
$.fn.fmatter.link = function(cellval, opts) {
var op = {target:opts.target };
var target = "";
if(!$.fmatter.isUndefined(opts.colModel.formatoptions)) {
op = $.extend({},op,opts.colModel.formatoptions);
}
if(op.target) {target = 'target=' + op.target;}
if(!$.fmatter.isEmpty(cellval)) {
return "<a "+target+" href=\"" + cellval + "\">" + cellval + "</a>";
}else {
return $.fn.fmatter.defaultFormat(cellval,opts);
}
};
$.fn.fmatter.showlink = function(cellval, opts) {
var op = {baseLinkUrl: opts.baseLinkUrl,showAction:opts.showAction, addParam: opts.addParam || "", target: opts.target, idName: opts.idName },
target = "", idUrl;
if(!$.fmatter.isUndefined(opts.colModel.formatoptions)) {
op = $.extend({},op,opts.colModel.formatoptions);
}
if(op.target) {target = 'target=' + op.target;}
idUrl = op.baseLinkUrl+op.showAction + '?'+ op.idName+'='+opts.rowId+op.addParam;
if($.fmatter.isString(cellval) || $.fmatter.isNumber(cellval)) { //add this one even if its blank string
return "<a "+target+" href=\"" + idUrl + "\">" + cellval + "</a>";
}else {
return $.fn.fmatter.defaultFormat(cellval,opts);
}
};
$.fn.fmatter.integer = function(cellval, opts) {
var op = $.extend({},opts.integer);
if(!$.fmatter.isUndefined(opts.colModel.formatoptions)) {
op = $.extend({},op,opts.colModel.formatoptions);
}
if($.fmatter.isEmpty(cellval)) {
return op.defaultValue;
}
return $.fmatter.util.NumberFormat(cellval,op);
};
$.fn.fmatter.number = function (cellval, opts) {
var op = $.extend({},opts.number);
if(!$.fmatter.isUndefined(opts.colModel.formatoptions)) {
op = $.extend({},op,opts.colModel.formatoptions);
}
if($.fmatter.isEmpty(cellval)) {
return op.defaultValue;
}
return $.fmatter.util.NumberFormat(cellval,op);
};
$.fn.fmatter.currency = function (cellval, opts) {
var op = $.extend({},opts.currency);
if(!$.fmatter.isUndefined(opts.colModel.formatoptions)) {
op = $.extend({},op,opts.colModel.formatoptions);
}
if($.fmatter.isEmpty(cellval)) {
return op.defaultValue;
}
return $.fmatter.util.NumberFormat(cellval,op);
};
$.fn.fmatter.date = function (cellval, opts, rwd, act) {
var op = $.extend({},opts.date);
if(!$.fmatter.isUndefined(opts.colModel.formatoptions)) {
op = $.extend({},op,opts.colModel.formatoptions);
}
if(!op.reformatAfterEdit && act=='edit'){
return $.fn.fmatter.defaultFormat(cellval, opts);
} else if(!$.fmatter.isEmpty(cellval)) {
return $.fmatter.util.DateFormat(op.srcformat,cellval,op.newformat,op);
} else {
return $.fn.fmatter.defaultFormat(cellval, opts);
}
};
$.fn.fmatter.select = function (cellval,opts, rwd, act) {
// jqGrid specific
cellval = cellval + "";
var oSelect = false, ret=[];
if(!$.fmatter.isUndefined(opts.colModel.formatoptions)){
oSelect= opts.colModel.formatoptions.value;
} else if(!$.fmatter.isUndefined(opts.colModel.editoptions)){
oSelect= opts.colModel.editoptions.value;
}
if (oSelect) {
var msl = opts.colModel.editoptions.multiple === true ? true : false,
scell = [], sv;
if(msl) {scell = cellval.split(",");scell = $.map(scell,function(n){return $.trim(n);});}
if ($.fmatter.isString(oSelect)) {
// mybe here we can use some caching with care ????
var so = oSelect.split(";"), j=0;
for(var i=0; i<so.length;i++){
sv = so[i].split(":");
if(sv.length > 2 ) {
sv[1] = jQuery.map(sv,function(n,i){if(i>0) { return n; } }).join(":");
}
if(msl) {
if(jQuery.inArray(sv[0],scell)>-1) {
ret[j] = sv[1];
j++;
}
} else if($.trim(sv[0])==$.trim(cellval)) {
ret[0] = sv[1];
break;
}
}
} else if($.fmatter.isObject(oSelect)) {
// this is quicker
if(msl) {
ret = jQuery.map(scell, function(n, i){
return oSelect[n];
});
} else {
ret[0] = oSelect[cellval] || "";
}
}
}
cellval = ret.join(", ");
return cellval === "" ? $.fn.fmatter.defaultFormat(cellval,opts) : cellval;
};
$.fn.fmatter.rowactions = function(rid,gid,act,pos) {
var op ={
keys:false,
editbutton:true,
delbutton:true,
onEdit : null,
onSuccess: null,
afterSave:null,
onError: null,
afterRestore: null,
extraparam: {oper:'edit'},
url: null,
delOptions: {}
},
cm = $('#'+gid)[0].p.colModel[pos];
if(!$.fmatter.isUndefined(cm.formatoptions)) {
op = $.extend(op,cm.formatoptions);
}
var saverow = function( rowid) {
if(op.afterSave) op.afterSave(rowid);
$("tr#"+rid+" div.ui-inline-edit, "+"tr#"+rid+" div.ui-inline-del","#"+gid).show();
$("tr#"+rid+" div.ui-inline-save, "+"tr#"+rid+" div.ui-inline-cancel","#"+gid).hide();
},
restorerow = function( rowid) {
if(op.afterRestore) op.afterRestore(rowid);
$("tr#"+rid+" div.ui-inline-edit, "+"tr#"+rid+" div.ui-inline-del","#"+gid).show();
$("tr#"+rid+" div.ui-inline-save, "+"tr#"+rid+" div.ui-inline-cancel","#"+gid).hide();
};
switch(act)
{
case 'edit':
$('#'+gid).jqGrid('editRow',rid, op.keys, op.onEdit, op.onSuccess, op.url, op.extraparam, saverow, op.onError,restorerow);
$("tr#"+rid+" div.ui-inline-edit, "+"tr#"+rid+" div.ui-inline-del","#"+gid).hide();
$("tr#"+rid+" div.ui-inline-save, "+"tr#"+rid+" div.ui-inline-cancel","#"+gid).show();
break;
case 'save':
$('#'+gid).jqGrid('saveRow',rid, op.onSuccess,op.url, op.extraparam, saverow, op.onError,restorerow);
$("tr#"+rid+" div.ui-inline-edit, "+"tr#"+rid+" div.ui-inline-del","#"+gid).show();
$("tr#"+rid+" div.ui-inline-save, "+"tr#"+rid+" div.ui-inline-cancel","#"+gid).hide();
break;
case 'cancel' :
$('#'+gid).jqGrid('restoreRow',rid, restorerow);
$("tr#"+rid+" div.ui-inline-edit, "+"tr#"+rid+" div.ui-inline-del","#"+gid).show();
$("tr#"+rid+" div.ui-inline-save, "+"tr#"+rid+" div.ui-inline-cancel","#"+gid).hide();
break;
case 'del':
$('#'+gid).jqGrid('delGridRow',rid, op.delOptions);
break;
}
};
$.fn.fmatter.actions = function(cellval,opts, rwd) {
var op ={keys:false, editbutton:true, delbutton:true};
if(!$.fmatter.isUndefined(opts.colModel.formatoptions)) {
op = $.extend(op,opts.colModel.formatoptions);
}
var rowid = opts.rowId, str="",ocl;
if(typeof(rowid) =='undefined' || $.fmatter.isEmpty(rowid)) { return ""; }
if(op.editbutton){
ocl = "onclick=$.fn.fmatter.rowactions('"+rowid+"','"+opts.gid+"','edit',"+opts.pos+");";
str =str+ "<div style='margin-left:8px;'><div title='"+$.jgrid.nav.edittitle+"' style='float:left;cursor:pointer;' class='ui-pg-div ui-inline-edit' "+ocl+"><span class='ui-icon ui-icon-pencil'></span></div>";
}
if(op.delbutton) {
ocl = "onclick=$.fn.fmatter.rowactions('"+rowid+"','"+opts.gid+"','del',"+opts.pos+");";
str = str+"<div title='"+$.jgrid.nav.deltitle+"' style='float:left;margin-left:5px;' class='ui-pg-div ui-inline-del' "+ocl+"><span class='ui-icon ui-icon-trash'></span></div>";
}
ocl = "onclick=$.fn.fmatter.rowactions('"+rowid+"','"+opts.gid+"','save',"+opts.pos+");";
str = str+"<div title='"+$.jgrid.edit.bSubmit+"' style='float:left;display:none' class='ui-pg-div ui-inline-save'><span class='ui-icon ui-icon-disk' "+ocl+"></span></div>";
ocl = "onclick=$.fn.fmatter.rowactions('"+rowid+"','"+opts.gid+"','cancel',"+opts.pos+");";
str = str+"<div title='"+$.jgrid.edit.bCancel+"' style='float:left;display:none;margin-left:5px;' class='ui-pg-div ui-inline-cancel'><span class='ui-icon ui-icon-cancel' "+ocl+"></span></div></div>";
return str;
};
$.unformat = function (cellval,options,pos,cnt) {
// specific for jqGrid only
var ret, formatType = options.colModel.formatter,
op =options.colModel.formatoptions || {}, sep,
re = /([\.\*\_\'\(\)\{\}\+\?\\])/g,
unformatFunc = options.colModel.unformat||($.fn.fmatter[formatType] && $.fn.fmatter[formatType].unformat);
if(typeof unformatFunc !== 'undefined' && $.isFunction(unformatFunc) ) {
ret = unformatFunc($(cellval).text(), options, cellval);
} else if(!$.fmatter.isUndefined(formatType) && $.fmatter.isString(formatType) ) {
var opts = $.jgrid.formatter || {}, stripTag;
switch(formatType) {
case 'integer' :
op = $.extend({},opts.integer,op);
sep = op.thousandsSeparator.replace(re,"\\$1");
stripTag = new RegExp(sep, "g");
ret = $(cellval).text().replace(stripTag,'');
break;
case 'number' :
op = $.extend({},opts.number,op);
sep = op.thousandsSeparator.replace(re,"\\$1");
stripTag = new RegExp(sep, "g");
ret = $(cellval).text().replace(stripTag,"").replace(op.decimalSeparator,'.');
break;
case 'currency':
op = $.extend({},opts.currency,op);
sep = op.thousandsSeparator.replace(re,"\\$1");
stripTag = new RegExp(sep, "g");
ret = $(cellval).text().replace(stripTag,'').replace(op.decimalSeparator,'.').replace(op.prefix,'').replace(op.suffix,'');
break;
case 'checkbox':
var cbv = (options.colModel.editoptions) ? options.colModel.editoptions.value.split(":") : ["Yes","No"];
ret = $('input',cellval).attr("checked") ? cbv[0] : cbv[1];
break;
case 'select' :
ret = $.unformat.select(cellval,options,pos,cnt);
break;
case 'actions':
return "";
default:
ret= $(cellval).text();
}
}
return ret ? ret : cnt===true ? $(cellval).text() : $.jgrid.htmlDecode($(cellval).html());
};
$.unformat.select = function (cellval,options,pos,cnt) {
// Spacial case when we have local data and perform a sort
// cnt is set to true only in sortDataArray
var ret = [];
var cell = $(cellval).text();
if(cnt===true) { return cell; }
var op = $.extend({},options.colModel.editoptions);
if(op.value){
var oSelect = op.value,
msl = op.multiple === true ? true : false,
scell = [], sv;
if(msl) { scell = cell.split(","); scell = $.map(scell,function(n){return $.trim(n);}); }
if ($.fmatter.isString(oSelect)) {
var so = oSelect.split(";"), j=0;
for(var i=0; i<so.length;i++){
sv = so[i].split(":");
if(sv.length > 2 ) {
sv[1] = jQuery.map(sv,function(n,i){if(i>0) { return n; } }).join(":");
}
if(msl) {
if(jQuery.inArray(sv[1],scell)>-1) {
ret[j] = sv[0];
j++;
}
} else if($.trim(sv[1])==$.trim(cell)) {
ret[0] = sv[0];
break;
}
}
} else if($.fmatter.isObject(oSelect) || $.isArray(oSelect) ){
if(!msl) { scell[0] = cell; }
ret = jQuery.map(scell, function(n){
var rv;
$.each(oSelect, function(i,val){
if (val == n) {
rv = i;
return false;
}
});
if( typeof(rv) != 'undefined' ) { return rv; }
});
}
return ret.join(", ");
} else {
return cell || "";
}
};
$.unformat.date = function (cellval, opts) {
var op = $.jgrid.formatter.date || {};
if(!$.fmatter.isUndefined(opts.formatoptions)) {
op = $.extend({},op,opts.formatoptions);
}
if(!$.fmatter.isEmpty(cellval)) {
return $.fmatter.util.DateFormat(op.newformat,cellval,op.srcformat,op);
} else {
return $.fn.fmatter.defaultFormat(cellval, opts);
}
};
})(jQuery); | zzh-simple-hr | ZJs/webapp/grid/jqgrid/3.8.2/src/jquery.fmatter.js | JavaScript | art | 20,655 |
/*
* jqDnR - Minimalistic Drag'n'Resize for jQuery.
*
* Copyright (c) 2007 Brice Burgess <bhb@iceburg.net>, http://www.iceburg.net
* Licensed under the MIT License:
* http://www.opensource.org/licenses/mit-license.php
*
* $Version: 2007.08.19 +r2
*/
(function($){
$.fn.jqDrag=function(h){return i(this,h,'d');};
$.fn.jqResize=function(h,ar){return i(this,h,'r',ar);};
$.jqDnR={
dnr:{},
e:0,
drag:function(v){
if(M.k == 'd')E.css({left:M.X+v.pageX-M.pX,top:M.Y+v.pageY-M.pY});
else {
E.css({width:Math.max(v.pageX-M.pX+M.W,0),height:Math.max(v.pageY-M.pY+M.H,0)});
if(M1){E1.css({width:Math.max(v.pageX-M1.pX+M1.W,0),height:Math.max(v.pageY-M1.pY+M1.H,0)});}
}
return false;
},
stop:function(){
//E.css('opacity',M.o);
$(document).unbind('mousemove',J.drag).unbind('mouseup',J.stop);
}
};
var J=$.jqDnR,M=J.dnr,E=J.e,E1,
i=function(e,h,k,aR){
return e.each(function(){
h=(h)?$(h,e):e;
h.bind('mousedown',{e:e,k:k},function(v){
var d=v.data,p={};E=d.e;E1 = aR ? $(aR) : false;
// attempt utilization of dimensions plugin to fix IE issues
if(E.css('position') != 'relative'){try{E.position(p);}catch(e){}}
M={
X:p.left||f('left')||0,
Y:p.top||f('top')||0,
W:f('width')||E[0].scrollWidth||0,
H:f('height')||E[0].scrollHeight||0,
pX:v.pageX,
pY:v.pageY,
k:d.k
//o:E.css('opacity')
};
// also resize
if(E1 && d.k != 'd'){
M1={
X:p.left||f1('left')||0,
Y:p.top||f1('top')||0,
W:E1[0].offsetWidth||f1('width')||0,
H:E1[0].offsetHeight||f1('height')||0,
pX:v.pageX,
pY:v.pageY,
k:d.k
};
} else {M1 = false;}
//E.css({opacity:0.8});
try {$("input.hasDatepicker",E[0]).datepicker('hide');}catch (dpe){}
$(document).mousemove($.jqDnR.drag).mouseup($.jqDnR.stop);
return false;
});
});
},
f=function(k){return parseInt(E.css(k))||false;};
f1=function(k){ return parseInt(E1.css(k))||false;};
})(jQuery); | zzh-simple-hr | ZJs/webapp/grid/jqgrid/3.8.2/src/jqDnR.js | JavaScript | art | 2,039 |
;(function($){
/**
* jqGrid extension for manipulating Grid Data
* Tony Tomov tony@trirand.com
* http://trirand.com/blog/
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl-2.0.html
**/
$.jgrid.extend({
//Editing
editRow : function(rowid,keys,oneditfunc,succesfunc, url, extraparam, aftersavefunc,errorfunc, afterrestorefunc) {
return this.each(function(){
var $t = this, nm, tmp, editable, cnt=0, focus=null, svr={}, ind,cm;
if (!$t.grid ) { return; }
ind = $($t).jqGrid("getInd",rowid,true);
if( ind === false ) {return;}
editable = $(ind).attr("editable") || "0";
if (editable == "0" && !$(ind).hasClass("not-editable-row")) {
cm = $t.p.colModel;
$('td',ind).each( function(i) {
nm = cm[i].name;
var treeg = $t.p.treeGrid===true && nm == $t.p.ExpandColumn;
if(treeg) { tmp = $("span:first",this).html();}
else {
try {
tmp = $.unformat(this,{rowId:rowid, colModel:cm[i]},i);
} catch (_) {
tmp = $(this).html();
}
}
if ( nm != 'cb' && nm != 'subgrid' && nm != 'rn') {
if($t.p.autoencode) { tmp = $.jgrid.htmlDecode(tmp); }
svr[nm]=tmp;
if(cm[i].editable===true) {
if(focus===null) { focus = i; }
if (treeg) { $("span:first",this).html(""); }
else { $(this).html(""); }
var opt = $.extend({},cm[i].editoptions || {},{id:rowid+"_"+nm,name:nm});
if(!cm[i].edittype) { cm[i].edittype = "text"; }
var elc = $.jgrid.createEl(cm[i].edittype,opt,tmp,true,$.extend({},$.jgrid.ajaxOptions,$t.p.ajaxSelectOptions || {}));
$(elc).addClass("editable");
if(treeg) { $("span:first",this).append(elc); }
else { $(this).append(elc); }
//Again IE
if(cm[i].edittype == "select" && cm[i].editoptions.multiple===true && $.browser.msie) {
$(elc).width($(elc).width());
}
cnt++;
}
}
});
if(cnt > 0) {
svr.id = rowid; $t.p.savedRow.push(svr);
$(ind).attr("editable","1");
$("td:eq("+focus+") input",ind).focus();
if(keys===true) {
$(ind).bind("keydown",function(e) {
if (e.keyCode === 27) {$($t).jqGrid("restoreRow",rowid, afterrestorefunc);}
if (e.keyCode === 13) {
var ta = e.target;
if(ta.tagName == 'TEXTAREA') { return true; }
$($t).jqGrid("saveRow",rowid,succesfunc, url, extraparam, aftersavefunc,errorfunc, afterrestorefunc );
return false;
}
e.stopPropagation();
});
}
if( $.isFunction(oneditfunc)) { oneditfunc.call($t, rowid); }
}
}
});
},
saveRow : function(rowid, succesfunc, url, extraparam, aftersavefunc,errorfunc, afterrestorefunc) {
return this.each(function(){
var $t = this, nm, tmp={}, tmp2={}, editable, fr, cv, ind;
if (!$t.grid ) { return; }
ind = $($t).jqGrid("getInd",rowid,true);
if(ind === false) {return;}
editable = $(ind).attr("editable");
url = url ? url : $t.p.editurl;
if (editable==="1") {
var cm;
$("td",ind).each(function(i) {
cm = $t.p.colModel[i];
nm = cm.name;
if ( nm != 'cb' && nm != 'subgrid' && cm.editable===true && nm != 'rn') {
switch (cm.edittype) {
case "checkbox":
var cbv = ["Yes","No"];
if(cm.editoptions ) {
cbv = cm.editoptions.value.split(":");
}
tmp[nm]= $("input",this).attr("checked") ? cbv[0] : cbv[1];
break;
case 'text':
case 'password':
case 'textarea':
case "button" :
tmp[nm]=$("input, textarea",this).val();
break;
case 'select':
if(!cm.editoptions.multiple) {
tmp[nm] = $("select>option:selected",this).val();
tmp2[nm] = $("select>option:selected", this).text();
} else {
var sel = $("select",this), selectedText = [];
tmp[nm] = $(sel).val();
if(tmp[nm]) { tmp[nm]= tmp[nm].join(","); } else { tmp[nm] =""; }
$("select > option:selected",this).each(
function(i,selected){
selectedText[i] = $(selected).text();
}
);
tmp2[nm] = selectedText.join(",");
}
if(cm.formatter && cm.formatter == 'select') { tmp2={}; }
break;
case 'custom' :
try {
if(cm.editoptions && $.isFunction(cm.editoptions.custom_value)) {
tmp[nm] = cm.editoptions.custom_value.call($t, $(".customelement",this),'get');
if (tmp[nm] === undefined) { throw "e2"; }
} else { throw "e1"; }
} catch (e) {
if (e=="e1") { $.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+$.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose); }
if (e=="e2") { $.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+$.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose); }
else { $.jgrid.info_dialog(jQuery.jgrid.errors.errcap,e.message,jQuery.jgrid.edit.bClose); }
}
break;
}
cv = $.jgrid.checkValues(tmp[nm],i,$t);
if(cv[0] === false) {
cv[1] = tmp[nm] + " " + cv[1];
return false;
}
if($t.p.autoencode) { tmp[nm] = $.jgrid.htmlEncode(tmp[nm]); }
}
});
if (cv[0] === false){
try {
var positions = $.jgrid.findPos($("#"+$.jgrid.jqID(rowid), $t.grid.bDiv)[0]);
$.jgrid.info_dialog($.jgrid.errors.errcap,cv[1],$.jgrid.edit.bClose,{left:positions[0],top:positions[1]});
} catch (e) {
alert(cv[1]);
}
return;
}
if(tmp) {
var idname, opers, oper;
opers = $t.p.prmNames;
oper = opers.oper;
idname = opers.id;
tmp[oper] = opers.editoper;
tmp[idname] = rowid;
if(typeof($t.p.inlineData) == 'undefined') { $t.p.inlineData ={}; }
if(typeof(extraparam) == 'undefined') { extraparam ={}; }
tmp = $.extend({},tmp,$t.p.inlineData,extraparam);
}
if (url == 'clientArray') {
tmp = $.extend({},tmp, tmp2);
if($t.p.autoencode) {
$.each(tmp,function(n,v){
tmp[n] = $.jgrid.htmlDecode(v);
});
}
var resp = $($t).jqGrid("setRowData",rowid,tmp);
$(ind).attr("editable","0");
for( var k=0;k<$t.p.savedRow.length;k++) {
if( $t.p.savedRow[k].id == rowid) {fr = k; break;}
}
if(fr >= 0) { $t.p.savedRow.splice(fr,1); }
if( $.isFunction(aftersavefunc) ) { aftersavefunc.call($t, rowid,resp); }
} else {
$("#lui_"+$t.p.id).show();
$.ajax($.extend({
url:url,
data: $.isFunction($t.p.serializeRowData) ? $t.p.serializeRowData.call($t, tmp) : tmp,
type: "POST",
complete: function(res,stat){
$("#lui_"+$t.p.id).hide();
if (stat === "success"){
var ret;
if( $.isFunction(succesfunc)) { ret = succesfunc.call($t, res);}
else { ret = true; }
if (ret===true) {
if($t.p.autoencode) {
$.each(tmp,function(n,v){
tmp[n] = $.jgrid.htmlDecode(v);
});
}
tmp = $.extend({},tmp, tmp2);
$($t).jqGrid("setRowData",rowid,tmp);
$(ind).attr("editable","0");
for( var k=0;k<$t.p.savedRow.length;k++) {
if( $t.p.savedRow[k].id == rowid) {fr = k; break;}
}
if(fr >= 0) { $t.p.savedRow.splice(fr,1); }
if( $.isFunction(aftersavefunc) ) { aftersavefunc.call($t, rowid,res); }
} else {
if($.isFunction(errorfunc) ) {
errorfunc.call($t, rowid, res, stat);
}
$($t).jqGrid("restoreRow",rowid, afterrestorefunc);
}
}
},
error:function(res,stat){
$("#lui_"+$t.p.id).hide();
if($.isFunction(errorfunc) ) {
errorfunc.call($t, rowid, res, stat);
} else {
alert("Error Row: "+rowid+" Result: " +res.status+":"+res.statusText+" Status: "+stat);
}
$($t).jqGrid("restoreRow",rowid, afterrestorefunc);
}
}, $.jgrid.ajaxOptions, $t.p.ajaxRowOptions || {}));
}
$(ind).unbind("keydown");
}
});
},
restoreRow : function(rowid, afterrestorefunc) {
return this.each(function(){
var $t= this, fr, ind, ares={};
if (!$t.grid ) { return; }
ind = $($t).jqGrid("getInd",rowid,true);
if(ind === false) {return;}
for( var k=0;k<$t.p.savedRow.length;k++) {
if( $t.p.savedRow[k].id == rowid) {fr = k; break;}
}
if(fr >= 0) {
if($.isFunction($.fn.datepicker)) {
try {
$("input.hasDatepicker","#"+$.jgrid.jqID(ind.id)).datepicker('hide');
} catch (e) {}
}
$.each($t.p.colModel, function(i,n){
if(this.editable === true && this.name in $t.p.savedRow[fr]) {
ares[this.name] = $t.p.savedRow[fr][this.name];
}
});
$($t).jqGrid("setRowData",rowid,ares);
$(ind).attr("editable","0").unbind("keydown");
$t.p.savedRow.splice(fr,1);
}
if ($.isFunction(afterrestorefunc))
{
afterrestorefunc.call($t, rowid);
}
});
}
//end inline edit
});
})(jQuery);
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/3.8.2/src/grid.inlinedit.js | JavaScript | art | 9,117 |
;(function($){
/**
* jqGrid extension for form editing Grid Data
* Tony Tomov tony@trirand.com
* http://trirand.com/blog/
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl-2.0.html
**/
var rp_ge = null;
$.jgrid.extend({
searchGrid : function (p) {
p = $.extend({
recreateFilter: false,
drag: true,
sField:'searchField',
sValue:'searchString',
sOper: 'searchOper',
sFilter: 'filters',
loadDefaults: true, // this options activates loading of default filters from grid's postData for Multipe Search only.
beforeShowSearch: null,
afterShowSearch : null,
onInitializeSearch: null,
closeAfterSearch : false,
closeAfterReset: false,
closeOnEscape : false,
multipleSearch : false,
cloneSearchRowOnAdd: true,
// translation
// if you want to change or remove the order change it in sopt
// ['bw','eq','ne','lt','le','gt','ge','ew','cn']
sopt: null,
// Note: stringResult is intentionally declared "undefined by default".
// you are velcome to define stringResult expressly in the options you pass to searchGrid()
// stringResult is a "safeguard" measure to insure we post sensible data when communicated as form-encoded
// see http://github.com/tonytomov/jqGrid/issues/#issue/36
//
// If this value is not expressly defined in the incoming options,
// lower in the code we will infer the value based on value of multipleSearch
stringResult: undefined,
onClose : null,
// useDataProxy allows ADD, EDIT and DEL code to bypass calling $.ajax
// directly when grid's 'dataProxy' property (grid.p.dataProxy) is a function.
// Used for "editGridRow" and "delGridRow" below and automatically flipped to TRUE
// when ajax setting's 'url' (grid's 'editurl') property is undefined.
// When 'useDataProxy' is true, instead of calling $.ajax.call(gridDOMobj, o, i) we call
// gridDOMobj.p.dataProxy.call(gridDOMobj, o, i)
//
// Behavior is extremely similar to when 'datatype' is a function, but arguments are slightly different.
// Normally the following is fed to datatype.call(a, b, c):
// a = Pointer to grid's table DOM element, b = grid.p.postdata, c = "load_"+grid's ID
// In cases of "edit" and "del" the following is fed:
// a = Pointer to grid's table DOM element (same),
// b = extended Ajax Options including postdata in "data" property. (different object type)
// c = "set_"+grid's ID in case of "edit" and "del_"+grid's ID in case of "del" (same type, different content)
// The major difference is that complete ajax options object, with attached "complete" and "error"
// callback functions is fed instead of only post data.
// This allows you to emulate a $.ajax call (including calling "complete"/"error"),
// while retrieving the data locally in the browser.
useDataProxy: false,
overlay : true
}, $.jgrid.search, p || {});
return this.each(function() {
var $t = this;
if(!$t.grid) {return;}
var fid = "fbox_"+$t.p.id,
showFrm = true;
function applyDefaultFilters(gridDOMobj, filterSettings) {
/*
gridDOMobj = ointer to grid DOM object ( $(#list)[0] )
What we need from gridDOMobj:
gridDOMobj.SearchFilter is the pointer to the Search box, once it's created.
gridDOMobj.p.postData - dictionary of post settings. These can be overriden at grid creation to
contain default filter settings. We will parse these and will populate the search with defaults.
filterSettings - same settings object you (would) pass to $().jqGrid('searchGrid', filterSettings);
*/
// Pulling default filter settings out of postData property of grid's properties.:
var defaultFilters = gridDOMobj.p.postData[filterSettings.sFilter];
// example of what we might get: {"groupOp":"and","rules":[{"field":"amount","op":"eq","data":"100"}]}
// suppose we have imported this with grid import, the this is a string.
if(typeof(defaultFilters) == "string") {
defaultFilters = $.jgrid.parse(defaultFilters);
}
if (defaultFilters) {
if (defaultFilters.groupOp) {
gridDOMobj.SearchFilter.setGroupOp(defaultFilters.groupOp);
}
if (defaultFilters.rules) {
var f, i = 0, li = defaultFilters.rules.length, success = false;
for (; i < li; i++) {
f = defaultFilters.rules[i];
// we are not trying to counter all issues with filter declaration here. Just the basics to avoid lookup exceptions.
if (f.field !== undefined && f.op !== undefined && f.data !== undefined) {
success = gridDOMobj.SearchFilter.setFilter({
'sfref':gridDOMobj.SearchFilter.$.find(".sf:last"),
'filter':$.extend({},f)
});
if (success) { gridDOMobj.SearchFilter.add(); }
}
}
}
}
} // end of applyDefaultFilters
function hideFilter(selector) {
if(p.onClose){
var fclm = p.onClose(selector);
if(typeof fclm == 'boolean' && !fclm) { return; }
}
selector.hide();
if(p.overlay === true) {
$(".jqgrid-overlay:first","#gbox_"+$t.p.id).hide();
}
}
function showFilter(){
var fl = $(".ui-searchFilter").length;
if(fl > 1) {
var zI = $("#"+fid).css("zIndex");
$("#"+fid).css({zIndex:parseInt(zI,10)+fl});
}
$("#"+fid).show();
if(p.overlay === true) {
$(".jqgrid-overlay:first","#gbox_"+$t.p.id).show();
}
try{$(':input:visible',"#"+fid)[0].focus();}catch(_){}
}
function searchFilters(filters) {
var hasFilters = (filters !== undefined),
grid = $("#"+$t.p.id),
sdata={};
if(p.multipleSearch===false) {
sdata[p.sField] = filters.rules[0].field;
sdata[p.sValue] = filters.rules[0].data;
sdata[p.sOper] = filters.rules[0].op;
} else {
sdata[p.sFilter] = filters;
}
grid[0].p.search = hasFilters;
$.extend(grid[0].p.postData,sdata);
grid.trigger("reloadGrid",[{page:1}]);
if(p.closeAfterSearch) { hideFilter($("#"+fid)); }
}
function resetFilters(op) {
var reload = op && op.hasOwnProperty("reload") ? op.reload : true,
grid = $("#"+$t.p.id),
sdata={};
grid[0].p.search = false;
if(p.multipleSearch===false) {
sdata[p.sField] = sdata[p.sValue] = sdata[p.sOper] = "";
} else {
sdata[p.sFilter] = "";
}
$.extend(grid[0].p.postData,sdata);
if(reload) {
grid.trigger("reloadGrid",[{page:1}]);
}
if(p.closeAfterReset) { hideFilter($("#"+fid)); }
}
if($.fn.searchFilter) {
if(p.recreateFilter===true) {$("#"+fid).remove();}
if( $("#"+fid).html() != null ) {
if ( $.isFunction(p.beforeShowSearch) ) {
showFrm = p.beforeShowSearch($("#"+fid));
if(typeof(showFrm) == "undefined") {
showFrm = true;
}
}
if(showFrm === false) { return; }
showFilter();
if( $.isFunction(p.afterShowSearch) ) { p.afterShowSearch($("#"+fid)); }
} else {
var fields = [],
colNames = $("#"+$t.p.id).jqGrid("getGridParam","colNames"),
colModel = $("#"+$t.p.id).jqGrid("getGridParam","colModel"),
stempl = ['eq','ne','lt','le','gt','ge','bw','bn','in','ni','ew','en','cn','nc'],
j,pos,k,oprtr=[];
if (p.sopt !==null) {
k=0;
for(j=0;j<p.sopt.length;j++) {
if( (pos= $.inArray(p.sopt[j],stempl)) != -1 ){
oprtr[k] = {op:p.sopt[j],text: p.odata[pos]};
k++;
}
}
} else {
for(j=0;j<stempl.length;j++) {
oprtr[j] = {op:stempl[j],text: p.odata[j]};
}
}
$.each(colModel, function(i, v) {
var searchable = (typeof v.search === 'undefined') ? true: v.search ,
hidden = (v.hidden === true),
soptions = $.extend({}, {text: colNames[i], itemval: v.index || v.name}, this.searchoptions),
ignoreHiding = (soptions.searchhidden === true);
if(typeof soptions.sopt !== 'undefined') {
k=0;
soptions.ops =[];
if(soptions.sopt.length>0) {
for(j=0;j<soptions.sopt.length;j++) {
if( (pos= $.inArray(soptions.sopt[j],stempl)) != -1 ){
soptions.ops[k] = {op:soptions.sopt[j],text: p.odata[pos]};
k++;
}
}
}
}
if(typeof(this.stype) === 'undefined') { this.stype='text'; }
if(this.stype == 'select') {
if ( soptions.dataUrl !== undefined) {}
else {
var eov;
if(soptions.value) {
eov = soptions.value;
} else if(this.editoptions) {
eov = this.editoptions.value;
}
if(eov) {
soptions.dataValues =[];
if(typeof(eov) === 'string') {
var so = eov.split(";"),sv;
for(j=0;j<so.length;j++) {
sv = so[j].split(":");
soptions.dataValues[j] ={value:sv[0],text:sv[1]};
}
} else if (typeof(eov) === 'object') {
j=0;
for (var key in eov) {
if(eov.hasOwnProperty(key)) {
soptions.dataValues[j] ={value:key,text:eov[key]};
j++;
}
}
}
}
}
}
if ((ignoreHiding && searchable) || (searchable && !hidden)) {
fields.push(soptions);
}
});
if(fields.length>0){
$("<div id='"+fid+"' role='dialog' tabindex='-1'></div>").insertBefore("#gview_"+$t.p.id);
// Before we create searchFilter we need to decide if we want to get back a string or a JS object.
// see http://github.com/tonytomov/jqGrid/issues/#issue/36 for background on the issue.
// If p.stringResult is defined, it was explisitly passed to us by user. Honor the choice, whatever it is.
if (p.stringResult===undefined) {
// to provide backward compatibility, inferring stringResult value from multipleSearch
p.stringResult = p.multipleSearch;
}
// we preserve the return value here to retain access to .add() and other good methods of search form.
$t.SearchFilter = $("#"+fid).searchFilter(fields, { groupOps: p.groupOps, operators: oprtr, onClose:hideFilter, resetText: p.Reset, searchText: p.Find, windowTitle: p.caption, rulesText:p.rulesText, matchText:p.matchText, onSearch: searchFilters, onReset: resetFilters,stringResult:p.stringResult, ajaxSelectOptions: $.extend({},$.jgrid.ajaxOptions,$t.p.ajaxSelectOptions ||{}), clone: p.cloneSearchRowOnAdd });
$(".ui-widget-overlay","#"+fid).remove();
if($t.p.direction=="rtl") { $(".ui-closer","#"+fid).css("float","left"); }
if (p.drag===true) {
$("#"+fid+" table thead tr:first td:first").css('cursor','move');
if(jQuery.fn.jqDrag) {
$("#"+fid).jqDrag($("#"+fid+" table thead tr:first td:first"));
} else {
try {
$("#"+fid).draggable({handle: $("#"+fid+" table thead tr:first td:first")});
} catch (e) {}
}
}
if(p.multipleSearch === false) {
$(".ui-del, .ui-add, .ui-del, .ui-add-last, .matchText, .rulesText", "#"+fid).hide();
$("select[name='groupOp']","#"+fid).hide();
}
if (p.multipleSearch === true && p.loadDefaults === true) {
applyDefaultFilters($t, p);
}
if ( $.isFunction(p.onInitializeSearch) ) { p.onInitializeSearch( $("#"+fid) ); }
if ( $.isFunction(p.beforeShowSearch) ) {
showFrm = p.beforeShowSearch($("#"+fid));
if(typeof(showFrm) == "undefined") {
showFrm = true;
}
}
if(showFrm === false) { return; }
showFilter();
if( $.isFunction(p.afterShowSearch) ) { p.afterShowSearch($("#"+fid)); }
if(p.closeOnEscape===true){
$("#"+fid).keydown( function( e ) {
if( e.which == 27 ) {
hideFilter($("#"+fid));
}
if (e.which == 13) {
$(".ui-search", this).click();
}
});
}
}
}
}
});
},
editGridRow : function(rowid, p){
p = $.extend({
top : 0,
left: 0,
width: 300,
height: 'auto',
dataheight: 'auto',
modal: false,
overlay : 10,
drag: true,
resize: true,
url: null,
mtype : "POST",
clearAfterAdd :true,
closeAfterEdit : false,
reloadAfterSubmit : true,
onInitializeForm: null,
beforeInitData: null,
beforeShowForm: null,
afterShowForm: null,
beforeSubmit: null,
afterSubmit: null,
onclickSubmit: null,
afterComplete: null,
onclickPgButtons : null,
afterclickPgButtons: null,
editData : {},
recreateForm : false,
jqModal : true,
closeOnEscape : false,
addedrow : "first",
topinfo : '',
bottominfo: '',
saveicon : [],
closeicon : [],
savekey: [false,13],
navkeys: [false,38,40],
checkOnSubmit : false,
checkOnUpdate : false,
_savedData : {},
processing : false,
onClose : null,
ajaxEditOptions : {},
serializeEditData : null,
viewPagerButtons : true
}, $.jgrid.edit, p || {});
rp_ge = p;
return this.each(function(){
var $t = this;
if (!$t.grid || !rowid) { return; }
var gID = $t.p.id,
frmgr = "FrmGrid_"+gID,frmtb = "TblGrid_"+gID,
IDs = {themodal:'editmod'+gID,modalhead:'edithd'+gID,modalcontent:'editcnt'+gID, scrollelm : frmgr},
onBeforeShow = $.isFunction(rp_ge.beforeShowForm) ? rp_ge.beforeShowForm : false,
onAfterShow = $.isFunction(rp_ge.afterShowForm) ? rp_ge.afterShowForm : false,
onBeforeInit = $.isFunction(rp_ge.beforeInitData) ? rp_ge.beforeInitData : false,
onInitializeForm = $.isFunction(rp_ge.onInitializeForm) ? rp_ge.onInitializeForm : false,
copydata = null,
showFrm = true,
maxCols = 1, maxRows=0, postdata, extpost, newData, diff;
if (rowid=="new") {
rowid = "_empty";
p.caption=p.addCaption;
} else {
p.caption=p.editCaption;
}
if(p.recreateForm===true && $("#"+IDs.themodal).html() != null) {
$("#"+IDs.themodal).remove();
}
var closeovrl = true;
if(p.checkOnUpdate && p.jqModal && !p.modal) {
closeovrl = false;
}
function getFormData(){
$(".FormElement", "#"+frmtb).each(function(i) {
var celm = $(".customelement", this);
if (celm.length) {
var elem = celm[0], nm = $(elem).attr('name');
$.each($t.p.colModel, function(i,n){
if(this.name == nm && this.editoptions && $.isFunction(this.editoptions.custom_value)) {
try {
postdata[nm] = this.editoptions.custom_value($("#"+nm,"#"+frmtb),'get');
if (postdata[nm] === undefined) { throw "e1"; }
} catch (e) {
if (e=="e1") { $.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+$.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose);}
else { $.jgrid.info_dialog(jQuery.jgrid.errors.errcap,e.message,jQuery.jgrid.edit.bClose); }
}
return true;
}
});
} else {
switch ($(this).get(0).type) {
case "checkbox":
if($(this).attr("checked")) {
postdata[this.name]= $(this).val();
}else {
var ofv = $(this).attr("offval");
postdata[this.name]= ofv;
}
break;
case "select-one":
postdata[this.name]= $("option:selected",this).val();
extpost[this.name]= $("option:selected",this).text();
break;
case "select-multiple":
postdata[this.name]= $(this).val();
if(postdata[this.name]) { postdata[this.name] = postdata[this.name].join(","); }
else { postdata[this.name] =""; }
var selectedText = [];
$("option:selected",this).each(
function(i,selected){
selectedText[i] = $(selected).text();
}
);
extpost[this.name]= selectedText.join(",");
break;
case "password":
case "text":
case "textarea":
case "button":
postdata[this.name] = $(this).val();
break;
}
if($t.p.autoencode) { postdata[this.name] = $.jgrid.htmlEncode(postdata[this.name]); }
}
});
return true;
}
function createData(rowid,obj,tb,maxcols){
var nm, hc,trdata, cnt=0,tmp, dc,elc, retpos=[], ind=false,
tdtmpl = "<td class='CaptionTD'> </td><td class='DataTD'> </td>", tmpl=""; //*2
for (var i =1;i<=maxcols;i++) {
tmpl += tdtmpl;
}
if(rowid != '_empty') {
ind = $(obj).jqGrid("getInd",rowid);
}
$(obj.p.colModel).each( function(i) {
nm = this.name;
// hidden fields are included in the form
if(this.editrules && this.editrules.edithidden === true) {
hc = false;
} else {
hc = this.hidden === true ? true : false;
}
dc = hc ? "style='display:none'" : "";
if ( nm !== 'cb' && nm !== 'subgrid' && this.editable===true && nm !== 'rn') {
if(ind === false) {
tmp = "";
} else {
if(nm == obj.p.ExpandColumn && obj.p.treeGrid === true) {
tmp = $("td:eq("+i+")",obj.rows[ind]).text();
} else {
try {
tmp = $.unformat($("td:eq("+i+")",obj.rows[ind]),{rowId:rowid, colModel:this},i);
} catch (_) {
tmp = $("td:eq("+i+")",obj.rows[ind]).html();
}
}
}
var opt = $.extend({}, this.editoptions || {} ,{id:nm,name:nm}),
frmopt = $.extend({}, {elmprefix:'',elmsuffix:'',rowabove:false,rowcontent:''}, this.formoptions || {}),
rp = parseInt(frmopt.rowpos,10) || cnt+1,
cp = parseInt((parseInt(frmopt.colpos,10) || 1)*2,10);
if(rowid == "_empty" && opt.defaultValue ) {
tmp = $.isFunction(opt.defaultValue) ? opt.defaultValue() : opt.defaultValue;
}
if(!this.edittype) { this.edittype = "text"; }
if($t.p.autoencode) { tmp = $.jgrid.htmlDecode(tmp); }
elc = $.jgrid.createEl(this.edittype,opt,tmp,false,$.extend({},$.jgrid.ajaxOptions,obj.p.ajaxSelectOptions || {}));
if(tmp === "" && this.edittype == "checkbox") {tmp = $(elc).attr("offval");}
if(tmp === "" && this.edittype == "select") {tmp = $("option:eq(0)",elc).text();}
if(rp_ge.checkOnSubmit || rp_ge.checkOnUpdate) { rp_ge._savedData[nm] = tmp; }
$(elc).addClass("FormElement");
if(this.edittype == 'text' || this.edittype == 'textarea') {
$(elc).addClass("ui-widget-content ui-corner-all");
}
trdata = $(tb).find("tr[rowpos="+rp+"]");
if(frmopt.rowabove) {
var newdata = $("<tr><td class='contentinfo' colspan='"+(maxcols*2)+"'>"+frmopt.rowcontent+"</td></tr>");
$(tb).append(newdata);
newdata[0].rp = rp;
}
if ( trdata.length===0 ) {
trdata = $("<tr "+dc+" rowpos='"+rp+"'></tr>").addClass("FormData").attr("id","tr_"+nm);
$(trdata).append(tmpl);
$(tb).append(trdata);
trdata[0].rp = rp;
}
$("td:eq("+(cp-2)+")",trdata[0]).html( typeof frmopt.label === 'undefined' ? obj.p.colNames[i]: frmopt.label);
$("td:eq("+(cp-1)+")",trdata[0]).append(frmopt.elmprefix).append(elc).append(frmopt.elmsuffix);
retpos[cnt] = i;
cnt++;
}
});
if( cnt > 0) {
var idrow = $("<tr class='FormData' style='display:none'><td class='CaptionTD'></td><td colspan='"+ (maxcols*2-1)+"' class='DataTD'><input class='FormElement' id='id_g' type='text' name='"+obj.p.id+"_id' value='"+rowid+"'/></td></tr>");
idrow[0].rp = cnt+999;
$(tb).append(idrow);
if(rp_ge.checkOnSubmit || rp_ge.checkOnUpdate) { rp_ge._savedData[obj.p.id+"_id"] = rowid; }
}
return retpos;
}
function fillData(rowid,obj,fmid){
var nm,cnt=0,tmp, fld,opt,vl,vlc;
if(rp_ge.checkOnSubmit || rp_ge.checkOnUpdate) {rp_ge._savedData = {};rp_ge._savedData[obj.p.id+"_id"]=rowid;}
var cm = obj.p.colModel;
if(rowid == '_empty') {
$(cm).each(function(i){
nm = this.name;
opt = $.extend({}, this.editoptions || {} );
fld = $("#"+$.jgrid.jqID(nm),"#"+fmid);
if(fld[0] != null) {
vl = "";
if(opt.defaultValue ) {
vl = $.isFunction(opt.defaultValue) ? opt.defaultValue() : opt.defaultValue;
if(fld[0].type=='checkbox') {
vlc = vl.toLowerCase();
if(vlc.search(/(false|0|no|off|undefined)/i)<0 && vlc!=="") {
fld[0].checked = true;
fld[0].defaultChecked = true;
fld[0].value = vl;
} else {
fld.attr({checked:"",defaultChecked:""});
}
} else {fld.val(vl); }
} else {
if( fld[0].type=='checkbox' ) {
fld[0].checked = false;
fld[0].defaultChecked = false;
vl = $(fld).attr("offval");
} else if (fld[0].type && fld[0].type.substr(0,6)=='select') {
fld[0].selectedIndex = 0;
} else {
fld.val(vl);
}
}
if(rp_ge.checkOnSubmit===true || rp_ge.checkOnUpdate) { rp_ge._savedData[nm] = vl; }
}
});
$("#id_g","#"+fmid).val(rowid);
return;
}
var tre = $(obj).jqGrid("getInd",rowid,true);
if(!tre) { return; }
$('td',tre).each( function(i) {
nm = cm[i].name;
// hidden fields are included in the form
if ( nm !== 'cb' && nm !== 'subgrid' && nm !== 'rn' && cm[i].editable===true) {
if(nm == obj.p.ExpandColumn && obj.p.treeGrid === true) {
tmp = $(this).text();
} else {
try {
tmp = $.unformat($(this),{rowId:rowid, colModel:cm[i]},i);
} catch (_) {
tmp = $(this).html();
}
}
if($t.p.autoencode) { tmp = $.jgrid.htmlDecode(tmp); }
if(rp_ge.checkOnSubmit===true || rp_ge.checkOnUpdate) { rp_ge._savedData[nm] = tmp; }
nm = $.jgrid.jqID(nm);
switch (cm[i].edittype) {
case "password":
case "text":
case "button" :
case "image":
$("#"+nm,"#"+fmid).val(tmp);
break;
case "textarea":
if(tmp == " " || tmp == " " || (tmp.length==1 && tmp.charCodeAt(0)==160) ) {tmp='';}
$("#"+nm,"#"+fmid).val(tmp);
break;
case "select":
var opv = tmp.split(",");
opv = $.map(opv,function(n){return $.trim(n);});
$("#"+nm+" option","#"+fmid).each(function(j){
if (!cm[i].editoptions.multiple && (opv[0] == $.trim($(this).text()) || opv[0] == $.trim($(this).val())) ){
this.selected= true;
} else if (cm[i].editoptions.multiple){
if( $.inArray($.trim($(this).text()), opv ) > -1 || $.inArray($.trim($(this).val()), opv ) > -1 ){
this.selected = true;
}else{
this.selected = false;
}
} else {
this.selected = false;
}
});
break;
case "checkbox":
tmp = tmp+"";
if(cm[i].editoptions && cm[i].editoptions.value) {
var cb = cm[i].editoptions.value.split(":");
if(cb[0] == tmp) {
$("#"+nm,"#"+fmid).attr("checked",true);
$("#"+nm,"#"+fmid).attr("defaultChecked",true); //ie
} else {
$("#"+nm,"#"+fmid).attr("checked",false);
$("#"+nm,"#"+fmid).attr("defaultChecked",""); //ie
}
} else {
tmp = tmp.toLowerCase();
if(tmp.search(/(false|0|no|off|undefined)/i)<0 && tmp!=="") {
$("#"+nm,"#"+fmid).attr("checked",true);
$("#"+nm,"#"+fmid).attr("defaultChecked",true); //ie
} else {
$("#"+nm,"#"+fmid).attr("checked",false);
$("#"+nm,"#"+fmid).attr("defaultChecked",""); //ie
}
}
break;
case 'custom' :
try {
if(cm[i].editoptions && $.isFunction(cm[i].editoptions.custom_value)) {
cm[i].editoptions.custom_value($("#"+nm,"#"+fmid),'set',tmp);
} else { throw "e1"; }
} catch (e) {
if (e=="e1") { $.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+$.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose);}
else { $.jgrid.info_dialog(jQuery.jgrid.errors.errcap,e.message,jQuery.jgrid.edit.bClose); }
}
break;
}
cnt++;
}
});
if(cnt>0) { $("#id_g","#"+frmtb).val(rowid); }
}
function postIt() {
var copydata, ret=[true,"",""], onCS = {}, opers = $t.p.prmNames, idname, oper;
if($.isFunction(rp_ge.beforeCheckValues)) {
var retvals = rp_ge.beforeCheckValues(postdata,$("#"+frmgr),postdata[$t.p.id+"_id"] == "_empty" ? opers.addoper : opers.editoper);
if(retvals && typeof(retvals) === 'object') { postdata = retvals; }
}
for( var key in postdata ){
if(postdata.hasOwnProperty(key)) {
ret = $.jgrid.checkValues(postdata[key],key,$t);
if(ret[0] === false) { break; }
}
}
if(ret[0]) {
if( $.isFunction( rp_ge.onclickSubmit)) { onCS = rp_ge.onclickSubmit(rp_ge,postdata) || {}; }
if( $.isFunction(rp_ge.beforeSubmit)) { ret = rp_ge.beforeSubmit(postdata,$("#"+frmgr)); }
}
if(ret[0] && !rp_ge.processing) {
rp_ge.processing = true;
$("#sData", "#"+frmtb+"_2").addClass('ui-state-active');
oper = opers.oper;
idname = opers.id;
// we add to pos data array the action - the name is oper
postdata[oper] = ($.trim(postdata[$t.p.id+"_id"]) == "_empty") ? opers.addoper : opers.editoper;
if(postdata[oper] != opers.addoper) {
postdata[idname] = postdata[$t.p.id+"_id"];
} else {
// check to see if we have allredy this field in the form and if yes lieve it
if( postdata[idname] === undefined ) { postdata[idname] = postdata[$t.p.id+"_id"]; }
}
delete postdata[$t.p.id+"_id"];
postdata = $.extend(postdata,rp_ge.editData,onCS);
var ajaxOptions = $.extend({
url: rp_ge.url ? rp_ge.url : $($t).jqGrid('getGridParam','editurl'),
type: rp_ge.mtype,
data: $.isFunction(rp_ge.serializeEditData) ? rp_ge.serializeEditData(postdata) : postdata,
complete:function(data,Status){
if(Status != "success") {
ret[0] = false;
if ($.isFunction(rp_ge.errorTextFormat)) {
ret[1] = rp_ge.errorTextFormat(data);
} else {
ret[1] = Status + " Status: '" + data.statusText + "'. Error code: " + data.status;
}
} else {
// data is posted successful
// execute aftersubmit with the returned data from server
if( $.isFunction(rp_ge.afterSubmit) ) {
ret = rp_ge.afterSubmit(data,postdata);
}
}
if(ret[0] === false) {
$("#FormError>td","#"+frmtb).html(ret[1]);
$("#FormError","#"+frmtb).show();
} else {
// remove some values if formattaer select or checkbox
$.each($t.p.colModel, function(i,n){
if(extpost[this.name] && this.formatter && this.formatter=='select') {
try {delete extpost[this.name];} catch (e) {}
}
});
postdata = $.extend(postdata,extpost);
if($t.p.autoencode) {
$.each(postdata,function(n,v){
postdata[n] = $.jgrid.htmlDecode(v);
});
}
rp_ge.reloadAfterSubmit = rp_ge.reloadAfterSubmit && $t.p.datatype != "local";
// the action is add
if(postdata[oper] == opers.addoper ) {
//id processing
// user not set the id ret[2]
if(!ret[2]) { ret[2] = (parseInt($t.p.records,10)+1)+""; }
postdata[idname] = ret[2];
if(rp_ge.closeAfterAdd) {
if(rp_ge.reloadAfterSubmit) { $($t).trigger("reloadGrid"); }
else {
$($t).jqGrid("addRowData",ret[2],postdata,p.addedrow);
$($t).jqGrid("setSelection",ret[2]);
}
$.jgrid.hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:p.jqModal,onClose: rp_ge.onClose});
} else if (rp_ge.clearAfterAdd) {
if(rp_ge.reloadAfterSubmit) { $($t).trigger("reloadGrid"); }
else { $($t).jqGrid("addRowData",ret[2],postdata,p.addedrow); }
fillData("_empty",$t,frmgr);
} else {
if(rp_ge.reloadAfterSubmit) { $($t).trigger("reloadGrid"); }
else { $($t).jqGrid("addRowData",ret[2],postdata,p.addedrow); }
}
} else {
// the action is update
if(rp_ge.reloadAfterSubmit) {
$($t).trigger("reloadGrid");
if( !rp_ge.closeAfterEdit ) { setTimeout(function(){$($t).jqGrid("setSelection",postdata[idname]);},1000); }
} else {
if($t.p.treeGrid === true) {
$($t).jqGrid("setTreeRow",postdata[idname],postdata);
} else {
$($t).jqGrid("setRowData",postdata[idname],postdata);
}
}
if(rp_ge.closeAfterEdit) { $.jgrid.hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:p.jqModal,onClose: rp_ge.onClose}); }
}
if($.isFunction(rp_ge.afterComplete)) {
copydata = data;
setTimeout(function(){rp_ge.afterComplete(copydata,postdata,$("#"+frmgr));copydata=null;},500);
}
}
rp_ge.processing=false;
if(rp_ge.checkOnSubmit || rp_ge.checkOnUpdate) {
$("#"+frmgr).data("disabled",false);
if(rp_ge._savedData[$t.p.id+"_id"] !="_empty"){
for(var key in rp_ge._savedData) {
if(postdata[key]) {
rp_ge._savedData[key] = postdata[key];
}
}
}
}
$("#sData", "#"+frmtb+"_2").removeClass('ui-state-active');
try{$(':input:visible',"#"+frmgr)[0].focus();} catch (e){}
},
error:function(xhr,st,err){
$("#FormError>td","#"+frmtb).html(st+ " : "+err);
$("#FormError","#"+frmtb).show();
rp_ge.processing=false;
$("#"+frmgr).data("disabled",false);
$("#sData", "#"+frmtb+"_2").removeClass('ui-state-active');
}
}, $.jgrid.ajaxOptions, rp_ge.ajaxEditOptions );
if (!ajaxOptions.url && !rp_ge.useDataProxy) {
if ($.isFunction($t.p.dataProxy)) {
rp_ge.useDataProxy = true;
} else {
ret[0]=false; ret[1] += " "+$.jgrid.errors.nourl;
}
}
if (ret[0]) {
if (rp_ge.useDataProxy) { $t.p.dataProxy.call($t, ajaxOptions, "set_"+$t.p.id); }
else { $.ajax(ajaxOptions); }
}
}
if(ret[0] === false) {
$("#FormError>td","#"+frmtb).html(ret[1]);
$("#FormError","#"+frmtb).show();
// return;
}
}
function compareData(nObj, oObj ) {
var ret = false,key;
for (key in nObj) {
if(nObj[key] != oObj[key]) {
ret = true;
break;
}
}
return ret;
}
function checkUpdates () {
var stat = true;
$("#FormError","#"+frmtb).hide();
if(rp_ge.checkOnUpdate) {
postdata = {}; extpost={};
getFormData();
newData = $.extend({},postdata,extpost);
diff = compareData(newData,rp_ge._savedData);
if(diff) {
$("#"+frmgr).data("disabled",true);
$(".confirm","#"+IDs.themodal).show();
stat = false;
}
}
return stat;
}
function restoreInline()
{
if (rowid !== "_empty" && typeof($t.p.savedRow) !== "undefined" && $t.p.savedRow.length > 0 && $.isFunction($.fn.jqGrid['restoreRow'])) {
for (var i=0;i<$t.p.savedRow.length;i++) {
if ($t.p.savedRow[i].id == rowid) {
$($t).jqGrid('restoreRow',rowid);
break;
}
}
}
}
if ( $("#"+IDs.themodal).html() != null ) {
if(onBeforeInit) {
showFrm = onBeforeInit($("#"+frmgr));
if(typeof(showFrm) == "undefined") {
showFrm = true;
}
}
if(showFrm === false) { return; }
restoreInline();
$(".ui-jqdialog-title","#"+IDs.modalhead).html(p.caption);
$("#FormError","#"+frmtb).hide();
if(rp_ge.topinfo) {
$(".topinfo","#"+frmtb+"_2").html(rp_ge.topinfo);
$(".tinfo","#"+frmtb+"_2").show();
} else {
$(".tinfo","#"+frmtb+"_2").hide();
}
if(rp_ge.bottominfo) {
$(".bottominfo","#"+frmtb+"_2").html(rp_ge.bottominfo);
$(".binfo","#"+frmtb+"_2").show();
} else {
$(".binfo","#"+frmtb+"_2").hide();
}
// filldata
fillData(rowid,$t,frmgr);
///
if(rowid=="_empty" || !rp_ge.viewPagerButtons) {
$("#pData, #nData","#"+frmtb+"_2").hide();
} else {
$("#pData, #nData","#"+frmtb+"_2").show();
}
if(rp_ge.processing===true) {
rp_ge.processing=false;
$("#sData", "#"+frmtb+"_2").removeClass('ui-state-active');
}
if($("#"+frmgr).data("disabled")===true) {
$(".confirm","#"+IDs.themodal).hide();
$("#"+frmgr).data("disabled",false);
}
if(onBeforeShow) { onBeforeShow($("#"+frmgr)); }
$("#"+IDs.themodal).data("onClose",rp_ge.onClose);
$.jgrid.viewModal("#"+IDs.themodal,{gbox:"#gbox_"+gID,jqm:p.jqModal, jqM: false, overlay: p.overlay, modal:p.modal});
if(!closeovrl) {
$(".jqmOverlay").click(function(){
if(!checkUpdates()) { return false; }
$.jgrid.hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:p.jqModal, onClose: rp_ge.onClose});
return false;
});
}
if(onAfterShow) { onAfterShow($("#"+frmgr)); }
} else {
var dh = isNaN(p.dataheight) ? p.dataheight : p.dataheight+"px",
frm = $("<form name='FormPost' id='"+frmgr+"' class='FormGrid' onSubmit='return false;' style='width:100%;overflow:auto;position:relative;height:"+dh+";'></form>").data("disabled",false),
tbl = $("<table id='"+frmtb+"' class='EditTable' cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>");
if(onBeforeInit) {
showFrm = onBeforeInit($("#"+frmgr));
if(typeof(showFrm) == "undefined") {
showFrm = true;
}
}
if(showFrm === false) { return; }
restoreInline();
$($t.p.colModel).each( function(i) {
var fmto = this.formoptions;
maxCols = Math.max(maxCols, fmto ? fmto.colpos || 0 : 0 );
maxRows = Math.max(maxRows, fmto ? fmto.rowpos || 0 : 0 );
});
$(frm).append(tbl);
var flr = $("<tr id='FormError' style='display:none'><td class='ui-state-error' colspan='"+(maxCols*2)+"'></td></tr>");
flr[0].rp = 0;
$(tbl).append(flr);
//topinfo
flr = $("<tr style='display:none' class='tinfo'><td class='topinfo' colspan='"+(maxCols*2)+"'>"+rp_ge.topinfo+"</td></tr>");
flr[0].rp = 0;
$(tbl).append(flr);
// set the id.
// use carefull only to change here colproperties.
// create data
var rtlb = $t.p.direction == "rtl" ? true :false,
bp = rtlb ? "nData" : "pData",
bn = rtlb ? "pData" : "nData";
createData(rowid,$t,tbl,maxCols);
// buttons at footer
var bP = "<a href='javascript:void(0)' id='"+bp+"' class='fm-button ui-state-default ui-corner-left'><span class='ui-icon ui-icon-triangle-1-w'></span></div>",
bN = "<a href='javascript:void(0)' id='"+bn+"' class='fm-button ui-state-default ui-corner-right'><span class='ui-icon ui-icon-triangle-1-e'></span></div>",
bS ="<a href='javascript:void(0)' id='sData' class='fm-button ui-state-default ui-corner-all'>"+p.bSubmit+"</a>",
bC ="<a href='javascript:void(0)' id='cData' class='fm-button ui-state-default ui-corner-all'>"+p.bCancel+"</a>";
var bt = "<table border='0' cellspacing='0' cellpadding='0' class='EditTable' id='"+frmtb+"_2'><tbody><tr><td colspan='2'><hr class='ui-widget-content' style='margin:1px'/></td></tr><tr id='Act_Buttons'><td class='navButton'>"+(rtlb ? bN+bP : bP+bN)+"</td><td class='EditButton'>"+bS+bC+"</td></tr>";
bt += "<tr style='display:none' class='binfo'><td class='bottominfo' colspan='2'>"+rp_ge.bottominfo+"</td></tr>";
bt += "</tbody></table>";
if(maxRows > 0) {
var sd=[];
$.each($(tbl)[0].rows,function(i,r){
sd[i] = r;
});
sd.sort(function(a,b){
if(a.rp > b.rp) {return 1;}
if(a.rp < b.rp) {return -1;}
return 0;
});
$.each(sd, function(index, row) {
$('tbody',tbl).append(row);
});
}
p.gbox = "#gbox_"+gID;
var cle = false;
if(p.closeOnEscape===true){
p.closeOnEscape = false;
cle = true;
}
var tms = $("<span></span>").append(frm).append(bt);
$.jgrid.createModal(IDs,tms,p,"#gview_"+$t.p.id,$("#gbox_"+$t.p.id)[0]);
if(rtlb) {
$("#pData, #nData","#"+frmtb+"_2").css("float","right");
$(".EditButton","#"+frmtb+"_2").css("text-align","left");
}
if(rp_ge.topinfo) { $(".tinfo","#"+frmtb+"_2").show(); }
if(rp_ge.bottominfo) { $(".binfo","#"+frmtb+"_2").show(); }
tms = null; bt=null;
$("#"+IDs.themodal).keydown( function( e ) {
var wkey = e.target;
if ($("#"+frmgr).data("disabled")===true ) { return false; }//??
if(rp_ge.savekey[0] === true && e.which == rp_ge.savekey[1]) { // save
if(wkey.tagName != "TEXTAREA") {
$("#sData", "#"+frmtb+"_2").trigger("click");
return false;
}
}
if(e.which === 27) {
if(!checkUpdates()) { return false; }
if(cle) { $.jgrid.hideModal(this,{gb:p.gbox,jqm:p.jqModal, onClose: rp_ge.onClose}); }
return false;
}
if(rp_ge.navkeys[0]===true) {
if($("#id_g","#"+frmtb).val() == "_empty") { return true; }
if(e.which == rp_ge.navkeys[1]){ //up
$("#pData", "#"+frmtb+"_2").trigger("click");
return false;
}
if(e.which == rp_ge.navkeys[2]){ //down
$("#nData", "#"+frmtb+"_2").trigger("click");
return false;
}
}
});
if(p.checkOnUpdate) {
$("a.ui-jqdialog-titlebar-close span","#"+IDs.themodal).removeClass("jqmClose");
$("a.ui-jqdialog-titlebar-close","#"+IDs.themodal).unbind("click")
.click(function(){
if(!checkUpdates()) { return false; }
$.jgrid.hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:p.jqModal,onClose: rp_ge.onClose});
return false;
});
}
p.saveicon = $.extend([true,"left","ui-icon-disk"],p.saveicon);
p.closeicon = $.extend([true,"left","ui-icon-close"],p.closeicon);
// beforeinitdata after creation of the form
if(p.saveicon[0]===true) {
$("#sData","#"+frmtb+"_2").addClass(p.saveicon[1] == "right" ? 'fm-button-icon-right' : 'fm-button-icon-left')
.append("<span class='ui-icon "+p.saveicon[2]+"'></span>");
}
if(p.closeicon[0]===true) {
$("#cData","#"+frmtb+"_2").addClass(p.closeicon[1] == "right" ? 'fm-button-icon-right' : 'fm-button-icon-left')
.append("<span class='ui-icon "+p.closeicon[2]+"'></span>");
}
if(rp_ge.checkOnSubmit || rp_ge.checkOnUpdate) {
bS ="<a href='javascript:void(0)' id='sNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+p.bYes+"</a>";
bN ="<a href='javascript:void(0)' id='nNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+p.bNo+"</a>";
bC ="<a href='javascript:void(0)' id='cNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+p.bExit+"</a>";
var ii, zI = p.zIndex || 999; zI ++;
if ($.browser.msie && $.browser.version ==6) {
ii = '<iframe style="display:block;position:absolute;z-index:-1;filter:Alpha(Opacity=\'0\');" src="javascript:false;"></iframe>';
} else { ii="";}
$("<div class='ui-widget-overlay jqgrid-overlay confirm' style='z-index:"+zI+";display:none;'> "+ii+"</div><div class='confirm ui-widget-content ui-jqconfirm' style='z-index:"+(zI+1)+"'>"+p.saveData+"<br/><br/>"+bS+bN+bC+"</div>").insertAfter("#"+frmgr);
$("#sNew","#"+IDs.themodal).click(function(){
postIt();
$("#"+frmgr).data("disabled",false);
$(".confirm","#"+IDs.themodal).hide();
return false;
});
$("#nNew","#"+IDs.themodal).click(function(){
$(".confirm","#"+IDs.themodal).hide();
$("#"+frmgr).data("disabled",false);
setTimeout(function(){$(":input","#"+frmgr)[0].focus();},0);
return false;
});
$("#cNew","#"+IDs.themodal).click(function(){
$(".confirm","#"+IDs.themodal).hide();
$("#"+frmgr).data("disabled",false);
$.jgrid.hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:p.jqModal,onClose: rp_ge.onClose});
return false;
});
}
// here initform - only once
if(onInitializeForm) { onInitializeForm($("#"+frmgr)); }
if(rowid=="_empty" || !rp_ge.viewPagerButtons) { $("#pData,#nData","#"+frmtb+"_2").hide(); } else { $("#pData,#nData","#"+frmtb+"_2").show(); }
if(onBeforeShow) { onBeforeShow($("#"+frmgr)); }
$("#"+IDs.themodal).data("onClose",rp_ge.onClose);
$.jgrid.viewModal("#"+IDs.themodal,{gbox:"#gbox_"+gID,jqm:p.jqModal, overlay: p.overlay,modal:p.modal});
if(!closeovrl) {
$(".jqmOverlay").click(function(){
if(!checkUpdates()) { return false; }
$.jgrid.hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:p.jqModal, onClose: rp_ge.onClose});
return false;
});
}
if(onAfterShow) { onAfterShow($("#"+frmgr)); }
$(".fm-button","#"+IDs.themodal).hover(
function(){$(this).addClass('ui-state-hover');},
function(){$(this).removeClass('ui-state-hover');}
);
$("#sData", "#"+frmtb+"_2").click(function(e){
postdata = {}; extpost={};
$("#FormError","#"+frmtb).hide();
// all depend on ret array
//ret[0] - succes
//ret[1] - msg if not succes
//ret[2] - the id that will be set if reload after submit false
getFormData();
if(postdata[$t.p.id+"_id"] == "_empty") { postIt(); }
else if(p.checkOnSubmit===true ) {
newData = $.extend({},postdata,extpost);
diff = compareData(newData,rp_ge._savedData);
if(diff) {
$("#"+frmgr).data("disabled",true);
$(".confirm","#"+IDs.themodal).show();
} else {
postIt();
}
} else {
postIt();
}
return false;
});
$("#cData", "#"+frmtb+"_2").click(function(e){
if(!checkUpdates()) { return false; }
$.jgrid.hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:p.jqModal,onClose: rp_ge.onClose});
return false;
});
$("#nData", "#"+frmtb+"_2").click(function(e){
if(!checkUpdates()) { return false; }
$("#FormError","#"+frmtb).hide();
var npos = getCurrPos();
npos[0] = parseInt(npos[0],10);
if(npos[0] != -1 && npos[1][npos[0]+1]) {
if($.isFunction(p.onclickPgButtons)) {
p.onclickPgButtons('next',$("#"+frmgr),npos[1][npos[0]]);
}
fillData(npos[1][npos[0]+1],$t,frmgr);
$($t).jqGrid("setSelection",npos[1][npos[0]+1]);
if($.isFunction(p.afterclickPgButtons)) {
p.afterclickPgButtons('next',$("#"+frmgr),npos[1][npos[0]+1]);
}
updateNav(npos[0]+1,npos[1].length-1);
}
return false;
});
$("#pData", "#"+frmtb+"_2").click(function(e){
if(!checkUpdates()) { return false; }
$("#FormError","#"+frmtb).hide();
var ppos = getCurrPos();
if(ppos[0] != -1 && ppos[1][ppos[0]-1]) {
if($.isFunction(p.onclickPgButtons)) {
p.onclickPgButtons('prev',$("#"+frmgr),ppos[1][ppos[0]]);
}
fillData(ppos[1][ppos[0]-1],$t,frmgr);
$($t).jqGrid("setSelection",ppos[1][ppos[0]-1]);
if($.isFunction(p.afterclickPgButtons)) {
p.afterclickPgButtons('prev',$("#"+frmgr),ppos[1][ppos[0]-1]);
}
updateNav(ppos[0]-1,ppos[1].length-1);
}
return false;
});
}
function updateNav(cr,totr,rid){
if (cr===0) { $("#pData","#"+frmtb+"_2").addClass('ui-state-disabled'); } else { $("#pData","#"+frmtb+"_2").removeClass('ui-state-disabled'); }
if (cr==totr) { $("#nData","#"+frmtb+"_2").addClass('ui-state-disabled'); } else { $("#nData","#"+frmtb+"_2").removeClass('ui-state-disabled'); }
}
function getCurrPos() {
var rowsInGrid = $($t).jqGrid("getDataIDs"),
selrow = $("#id_g","#"+frmtb).val(),
pos = $.inArray(selrow,rowsInGrid);
return [pos,rowsInGrid];
}
var posInit =getCurrPos();
updateNav(posInit[0],posInit[1].length-1);
});
},
viewGridRow : function(rowid, p){
p = $.extend({
top : 0,
left: 0,
width: 0,
height: 'auto',
dataheight: 'auto',
modal: false,
overlay: 10,
drag: true,
resize: true,
jqModal: true,
closeOnEscape : false,
labelswidth: '30%',
closeicon: [],
navkeys: [false,38,40],
onClose: null,
beforeShowForm : null,
beforeInitData : null,
viewPagerButtons : true
}, $.jgrid.view, p || {});
return this.each(function(){
var $t = this;
if (!$t.grid || !rowid) { return; }
if(!p.imgpath) { p.imgpath= $t.p.imgpath; }
// I hate to rewrite code, but ...
var gID = $t.p.id,
frmgr = "ViewGrid_"+gID , frmtb = "ViewTbl_"+gID,
IDs = {themodal:'viewmod'+gID,modalhead:'viewhd'+gID,modalcontent:'viewcnt'+gID, scrollelm : frmgr},
onBeforeInit = $.isFunction(p.beforeInitData) ? p.beforeInitData : false,
showFrm = true,
maxCols = 1, maxRows=0;
function focusaref(){ //Sfari 3 issues
if(p.closeOnEscape===true || p.navkeys[0]===true) {
setTimeout(function(){$(".ui-jqdialog-titlebar-close","#"+IDs.modalhead).focus();},0);
}
}
function createData(rowid,obj,tb,maxcols){
var nm, hc,trdata, cnt=0,tmp, dc, retpos=[], ind=false,
tdtmpl = "<td class='CaptionTD form-view-label ui-widget-content' width='"+p.labelswidth+"'> </td><td class='DataTD form-view-data ui-helper-reset ui-widget-content'> </td>", tmpl="",
tdtmpl2 = "<td class='CaptionTD form-view-label ui-widget-content'> </td><td class='DataTD form-view-data ui-widget-content'> </td>",
fmtnum = ['integer','number','currency'],max1 =0, max2=0 ,maxw,setme, viewfld;
for (var i =1;i<=maxcols;i++) {
tmpl += i == 1 ? tdtmpl : tdtmpl2;
}
// find max number align rigth with property formatter
$(obj.p.colModel).each( function(i) {
if(this.editrules && this.editrules.edithidden === true) {
hc = false;
} else {
hc = this.hidden === true ? true : false;
}
if(!hc && this.align==='right') {
if(this.formatter && $.inArray(this.formatter,fmtnum) !== -1 ) {
max1 = Math.max(max1,parseInt(this.width,10));
} else {
max2 = Math.max(max2,parseInt(this.width,10));
}
}
});
maxw = max1 !==0 ? max1 : max2 !==0 ? max2 : 0;
ind = $(obj).jqGrid("getInd",rowid);
$(obj.p.colModel).each( function(i) {
nm = this.name;
setme = false;
// hidden fields are included in the form
if(this.editrules && this.editrules.edithidden === true) {
hc = false;
} else {
hc = this.hidden === true ? true : false;
}
dc = hc ? "style='display:none'" : "";
viewfld = (typeof this.viewable != 'boolean') ? true : this.viewable;
if ( nm !== 'cb' && nm !== 'subgrid' && nm !== 'rn' && viewfld) {
if(ind === false) {
tmp = "";
} else {
if(nm == obj.p.ExpandColumn && obj.p.treeGrid === true) {
tmp = $("td:eq("+i+")",obj.rows[ind]).text();
} else {
tmp = $("td:eq("+i+")",obj.rows[ind]).html();
}
}
setme = this.align === 'right' && maxw !==0 ? true : false;
var opt = $.extend({}, this.editoptions || {} ,{id:nm,name:nm}),
frmopt = $.extend({},{rowabove:false,rowcontent:''}, this.formoptions || {}),
rp = parseInt(frmopt.rowpos,10) || cnt+1,
cp = parseInt((parseInt(frmopt.colpos,10) || 1)*2,10);
if(frmopt.rowabove) {
var newdata = $("<tr><td class='contentinfo' colspan='"+(maxcols*2)+"'>"+frmopt.rowcontent+"</td></tr>");
$(tb).append(newdata);
newdata[0].rp = rp;
}
trdata = $(tb).find("tr[rowpos="+rp+"]");
if ( trdata.length===0 ) {
trdata = $("<tr "+dc+" rowpos='"+rp+"'></tr>").addClass("FormData").attr("id","trv_"+nm);
$(trdata).append(tmpl);
$(tb).append(trdata);
trdata[0].rp = rp;
}
$("td:eq("+(cp-2)+")",trdata[0]).html('<b>'+ (typeof frmopt.label === 'undefined' ? obj.p.colNames[i]: frmopt.label)+'</b>');
$("td:eq("+(cp-1)+")",trdata[0]).append("<span>"+tmp+"</span>").attr("id","v_"+nm);
if(setme){
$("td:eq("+(cp-1)+") span",trdata[0]).css({'text-align':'right',width:maxw+"px"});
}
retpos[cnt] = i;
cnt++;
}
});
if( cnt > 0) {
var idrow = $("<tr class='FormData' style='display:none'><td class='CaptionTD'></td><td colspan='"+ (maxcols*2-1)+"' class='DataTD'><input class='FormElement' id='id_g' type='text' name='id' value='"+rowid+"'/></td></tr>");
idrow[0].rp = cnt+99;
$(tb).append(idrow);
}
return retpos;
}
function fillData(rowid,obj){
var nm, hc,cnt=0,tmp, opt,trv;
trv = $(obj).jqGrid("getInd",rowid,true);
if(!trv) { return; }
$('td',trv).each( function(i) {
nm = obj.p.colModel[i].name;
// hidden fields are included in the form
if(obj.p.colModel[i].editrules && obj.p.colModel[i].editrules.edithidden === true) {
hc = false;
} else {
hc = obj.p.colModel[i].hidden === true ? true : false;
}
if ( nm !== 'cb' && nm !== 'subgrid' && nm !== 'rn') {
if(nm == obj.p.ExpandColumn && obj.p.treeGrid === true) {
tmp = $(this).text();
} else {
tmp = $(this).html();
}
opt = $.extend({},obj.p.colModel[i].editoptions || {});
nm = $.jgrid.jqID("v_"+nm);
$("#"+nm+" span","#"+frmtb).html(tmp);
if (hc) { $("#"+nm,"#"+frmtb).parents("tr:first").hide(); }
cnt++;
}
});
if(cnt>0) { $("#id_g","#"+frmtb).val(rowid); }
}
if ( $("#"+IDs.themodal).html() != null ) {
if(onBeforeInit) {
showFrm = onBeforeInit($("#"+frmgr));
if(typeof(showFrm) == "undefined") {
showFrm = true;
}
}
if(showFrm === false) { return; }
$(".ui-jqdialog-title","#"+IDs.modalhead).html(p.caption);
$("#FormError","#"+frmtb).hide();
fillData(rowid,$t);
if($.isFunction(p.beforeShowForm)) { p.beforeShowForm($("#"+frmgr)); }
$.jgrid.viewModal("#"+IDs.themodal,{gbox:"#gbox_"+gID,jqm:p.jqModal, jqM: false, overlay: p.overlay, modal:p.modal});
focusaref();
} else {
var dh = isNaN(p.dataheight) ? p.dataheight : p.dataheight+"px";
var frm = $("<form name='FormPost' id='"+frmgr+"' class='FormGrid' style='width:100%;overflow:auto;position:relative;height:"+dh+";'></form>"),
tbl =$("<table id='"+frmtb+"' class='EditTable' cellspacing='1' cellpadding='2' border='0' style='table-layout:fixed'><tbody></tbody></table>");
if(onBeforeInit) {
showFrm = onBeforeInit($("#"+frmgr));
if(typeof(showFrm) == "undefined") {
showFrm = true;
}
}
if(showFrm === false) { return; }
$($t.p.colModel).each( function(i) {
var fmto = this.formoptions;
maxCols = Math.max(maxCols, fmto ? fmto.colpos || 0 : 0 );
maxRows = Math.max(maxRows, fmto ? fmto.rowpos || 0 : 0 );
});
// set the id.
$(frm).append(tbl);
createData(rowid, $t, tbl, maxCols);
var rtlb = $t.p.direction == "rtl" ? true :false,
bp = rtlb ? "nData" : "pData",
bn = rtlb ? "pData" : "nData",
// buttons at footer
bP = "<a href='javascript:void(0)' id='"+bp+"' class='fm-button ui-state-default ui-corner-left'><span class='ui-icon ui-icon-triangle-1-w'></span></a>",
bN = "<a href='javascript:void(0)' id='"+bn+"' class='fm-button ui-state-default ui-corner-right'><span class='ui-icon ui-icon-triangle-1-e'></span></a>",
bC ="<a href='javascript:void(0)' id='cData' class='fm-button ui-state-default ui-corner-all'>"+p.bClose+"</a>";
if(maxRows > 0) {
var sd=[];
$.each($(tbl)[0].rows,function(i,r){
sd[i] = r;
});
sd.sort(function(a,b){
if(a.rp > b.rp) {return 1;}
if(a.rp < b.rp) {return -1;}
return 0;
});
$.each(sd, function(index, row) {
$('tbody',tbl).append(row);
});
}
p.gbox = "#gbox_"+gID;
var cle = false;
if(p.closeOnEscape===true){
p.closeOnEscape = false;
cle = true;
}
var bt = $("<span></span>").append(frm).append("<table border='0' class='EditTable' id='"+frmtb+"_2'><tbody><tr id='Act_Buttons'><td class='navButton' width='"+p.labelswidth+"'>"+(rtlb ? bN+bP : bP+bN)+"</td><td class='EditButton'>"+bC+"</td></tr></tbody></table>");
$.jgrid.createModal(IDs,bt,p,"#gview_"+$t.p.id,$("#gview_"+$t.p.id)[0]);
if(rtlb) {
$("#pData, #nData","#"+frmtb+"_2").css("float","right");
$(".EditButton","#"+frmtb+"_2").css("text-align","left");
}
if(!p.viewPagerButtons) { $("#pData, #nData","#"+frmtb+"_2").hide(); }
bt = null;
$("#"+IDs.themodal).keydown( function( e ) {
if(e.which === 27) {
if(cle) { $.jgrid.hideModal(this,{gb:p.gbox,jqm:p.jqModal, onClose: p.onClose}); }
return false;
}
if(p.navkeys[0]===true) {
if(e.which === p.navkeys[1]){ //up
$("#pData", "#"+frmtb+"_2").trigger("click");
return false;
}
if(e.which === p.navkeys[2]){ //down
$("#nData", "#"+frmtb+"_2").trigger("click");
return false;
}
}
});
p.closeicon = $.extend([true,"left","ui-icon-close"],p.closeicon);
if(p.closeicon[0]===true) {
$("#cData","#"+frmtb+"_2").addClass(p.closeicon[1] == "right" ? 'fm-button-icon-right' : 'fm-button-icon-left')
.append("<span class='ui-icon "+p.closeicon[2]+"'></span>");
}
if($.isFunction(p.beforeShowForm)) { p.beforeShowForm($("#"+frmgr)); }
$.jgrid.viewModal("#"+IDs.themodal,{gbox:"#gbox_"+gID,jqm:p.jqModal, modal:p.modal});
$(".fm-button:not(.ui-state-disabled)","#"+frmtb+"_2").hover(
function(){$(this).addClass('ui-state-hover');},
function(){$(this).removeClass('ui-state-hover');}
);
focusaref();
$("#cData", "#"+frmtb+"_2").click(function(e){
$.jgrid.hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:p.jqModal, onClose: p.onClose});
return false;
});
$("#nData", "#"+frmtb+"_2").click(function(e){
$("#FormError","#"+frmtb).hide();
var npos = getCurrPos();
npos[0] = parseInt(npos[0],10);
if(npos[0] != -1 && npos[1][npos[0]+1]) {
if($.isFunction(p.onclickPgButtons)) {
p.onclickPgButtons('next',$("#"+frmgr),npos[1][npos[0]]);
}
fillData(npos[1][npos[0]+1],$t);
$($t).jqGrid("setSelection",npos[1][npos[0]+1]);
if($.isFunction(p.afterclickPgButtons)) {
p.afterclickPgButtons('next',$("#"+frmgr),npos[1][npos[0]+1]);
}
updateNav(npos[0]+1,npos[1].length-1);
}
focusaref();
return false;
});
$("#pData", "#"+frmtb+"_2").click(function(e){
$("#FormError","#"+frmtb).hide();
var ppos = getCurrPos();
if(ppos[0] != -1 && ppos[1][ppos[0]-1]) {
if($.isFunction(p.onclickPgButtons)) {
p.onclickPgButtons('prev',$("#"+frmgr),ppos[1][ppos[0]]);
}
fillData(ppos[1][ppos[0]-1],$t);
$($t).jqGrid("setSelection",ppos[1][ppos[0]-1]);
if($.isFunction(p.afterclickPgButtons)) {
p.afterclickPgButtons('prev',$("#"+frmgr),ppos[1][ppos[0]-1]);
}
updateNav(ppos[0]-1,ppos[1].length-1);
}
focusaref();
return false;
});
}
function updateNav(cr,totr,rid){
if (cr===0) { $("#pData","#"+frmtb+"_2").addClass('ui-state-disabled'); } else { $("#pData","#"+frmtb+"_2").removeClass('ui-state-disabled'); }
if (cr==totr) { $("#nData","#"+frmtb+"_2").addClass('ui-state-disabled'); } else { $("#nData","#"+frmtb+"_2").removeClass('ui-state-disabled'); }
}
function getCurrPos() {
var rowsInGrid = $($t).jqGrid("getDataIDs"),
selrow = $("#id_g","#"+frmtb).val(),
pos = $.inArray(selrow,rowsInGrid);
return [pos,rowsInGrid];
}
var posInit =getCurrPos();
updateNav(posInit[0],posInit[1].length-1);
});
},
delGridRow : function(rowids,p) {
p = $.extend({
top : 0,
left: 0,
width: 240,
height: 'auto',
dataheight : 'auto',
modal: false,
overlay: 10,
drag: true,
resize: true,
url : '',
mtype : "POST",
reloadAfterSubmit: true,
beforeShowForm: null,
beforeInitData : null,
afterShowForm: null,
beforeSubmit: null,
onclickSubmit: null,
afterSubmit: null,
jqModal : true,
closeOnEscape : false,
delData: {},
delicon : [],
cancelicon : [],
onClose : null,
ajaxDelOptions : {},
processing : false,
serializeDelData : null,
useDataProxy : false
}, $.jgrid.del, p ||{});
rp_ge = p;
return this.each(function(){
var $t = this;
if (!$t.grid ) { return; }
if(!rowids) { return; }
var onBeforeShow = typeof p.beforeShowForm === 'function' ? true: false,
onAfterShow = typeof p.afterShowForm === 'function' ? true: false,
onBeforeInit = $.isFunction(p.beforeInitData) ? p.beforeInitData : false,
gID = $t.p.id, onCS = {},
showFrm = true,
dtbl = "DelTbl_"+gID,postd, idname, opers, oper,
IDs = {themodal:'delmod'+gID,modalhead:'delhd'+gID,modalcontent:'delcnt'+gID, scrollelm: dtbl};
if (jQuery.isArray(rowids)) { rowids = rowids.join(); }
if ( $("#"+IDs.themodal).html() != null ) {
if(onBeforeInit) {
showFrm = onBeforeInit();
if(typeof(showFrm) == "undefined") {
showFrm = true;
}
}
if(showFrm === false) { return; }
$("#DelData>td","#"+dtbl).text(rowids);
$("#DelError","#"+dtbl).hide();
if( rp_ge.processing === true) {
rp_ge.processing=false;
$("#dData", "#"+dtbl).removeClass('ui-state-active');
}
if(onBeforeShow) { p.beforeShowForm($("#"+dtbl)); }
$.jgrid.viewModal("#"+IDs.themodal,{gbox:"#gbox_"+gID,jqm:p.jqModal,jqM: false, overlay: p.overlay, modal:p.modal});
if(onAfterShow) { p.afterShowForm($("#"+dtbl)); }
} else {
if(onBeforeInit) {
showFrm = onBeforeInit();
if(typeof(showFrm) == "undefined") {
showFrm = true;
}
}
if(showFrm === false) { return; }
var dh = isNaN(p.dataheight) ? p.dataheight : p.dataheight+"px";
var tbl = "<div id='"+dtbl+"' class='formdata' style='width:100%;overflow:auto;position:relative;height:"+dh+";'>";
tbl += "<table class='DelTable'><tbody>";
// error data
tbl += "<tr id='DelError' style='display:none'><td class='ui-state-error'></td></tr>";
tbl += "<tr id='DelData' style='display:none'><td >"+rowids+"</td></tr>";
tbl += "<tr><td class=\"delmsg\" style=\"white-space:pre;\">"+p.msg+"</td></tr><tr><td > </td></tr>";
// buttons at footer
tbl += "</tbody></table></div>";
var bS = "<a href='javascript:void(0)' id='dData' class='fm-button ui-state-default ui-corner-all'>"+p.bSubmit+"</a>",
bC = "<a href='javascript:void(0)' id='eData' class='fm-button ui-state-default ui-corner-all'>"+p.bCancel+"</a>";
tbl += "<table cellspacing='0' cellpadding='0' border='0' class='EditTable' id='"+dtbl+"_2'><tbody><tr><td><hr class='ui-widget-content' style='margin:1px'/></td></tr></tr><tr><td class='DelButton EditButton'>"+bS+" "+bC+"</td></tr></tbody></table>";
p.gbox = "#gbox_"+gID;
$.jgrid.createModal(IDs,tbl,p,"#gview_"+$t.p.id,$("#gview_"+$t.p.id)[0]);
$(".fm-button","#"+dtbl+"_2").hover(
function(){$(this).addClass('ui-state-hover');},
function(){$(this).removeClass('ui-state-hover');}
);
p.delicon = $.extend([true,"left","ui-icon-scissors"],p.delicon);
p.cancelicon = $.extend([true,"left","ui-icon-cancel"],p.cancelicon);
if(p.delicon[0]===true) {
$("#dData","#"+dtbl+"_2").addClass(p.delicon[1] == "right" ? 'fm-button-icon-right' : 'fm-button-icon-left')
.append("<span class='ui-icon "+p.delicon[2]+"'></span>");
}
if(p.cancelicon[0]===true) {
$("#eData","#"+dtbl+"_2").addClass(p.cancelicon[1] == "right" ? 'fm-button-icon-right' : 'fm-button-icon-left')
.append("<span class='ui-icon "+p.cancelicon[2]+"'></span>");
}
$("#dData","#"+dtbl+"_2").click(function(e){
var ret=[true,""]; onCS = {};
var postdata = $("#DelData>td","#"+dtbl).text(); //the pair is name=val1,val2,...
if( typeof p.onclickSubmit === 'function' ) { onCS = p.onclickSubmit(rp_ge, postdata) || {}; }
if( typeof p.beforeSubmit === 'function' ) { ret = p.beforeSubmit(postdata); }
if(ret[0] && !rp_ge.processing) {
rp_ge.processing = true;
$(this).addClass('ui-state-active');
opers = $t.p.prmNames;
postd = $.extend({},rp_ge.delData, onCS);
oper = opers.oper;
postd[oper] = opers.deloper;
idname = opers.id;
postd[idname] = postdata;
var ajaxOptions = $.extend({
url: rp_ge.url ? rp_ge.url : $($t).jqGrid('getGridParam','editurl'),
type: p.mtype,
data: $.isFunction(p.serializeDelData) ? p.serializeDelData(postd) : postd,
complete:function(data,Status){
if(Status != "success") {
ret[0] = false;
if ($.isFunction(rp_ge.errorTextFormat)) {
ret[1] = rp_ge.errorTextFormat(data);
} else {
ret[1] = Status + " Status: '" + data.statusText + "'. Error code: " + data.status;
}
} else {
// data is posted successful
// execute aftersubmit with the returned data from server
if( typeof rp_ge.afterSubmit === 'function' ) {
ret = rp_ge.afterSubmit(data,postd);
}
}
if(ret[0] === false) {
$("#DelError>td","#"+dtbl).html(ret[1]);
$("#DelError","#"+dtbl).show();
} else {
if(rp_ge.reloadAfterSubmit && $t.p.datatype != "local") {
$($t).trigger("reloadGrid");
} else {
var toarr = [];
toarr = postdata.split(",");
if($t.p.treeGrid===true){
try {$($t).jqGrid("delTreeNode",toarr[0]);} catch(e){}
} else {
for(var i=0;i<toarr.length;i++) {
$($t).jqGrid("delRowData",toarr[i]);
}
}
$t.p.selrow = null;
$t.p.selarrrow = [];
}
if($.isFunction(rp_ge.afterComplete)) {
setTimeout(function(){rp_ge.afterComplete(data,postdata);},500);
}
}
rp_ge.processing=false;
$("#dData", "#"+dtbl+"_2").removeClass('ui-state-active');
if(ret[0]) { $.jgrid.hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:p.jqModal, onClose: rp_ge.onClose}); }
},
error:function(xhr,st,err){
$("#DelError>td","#"+dtbl).html(st+ " : "+err);
$("#DelError","#"+dtbl).show();
rp_ge.processing=false;
$("#dData", "#"+dtbl+"_2").removeClass('ui-state-active');
}
}, $.jgrid.ajaxOptions, p.ajaxDelOptions);
if (!ajaxOptions.url && !rp_ge.useDataProxy) {
if ($.isFunction($t.p.dataProxy)) {
rp_ge.useDataProxy = true;
} else {
ret[0]=false; ret[1] += " "+$.jgrid.errors.nourl;
}
}
if (ret[0]) {
if (rp_ge.useDataProxy) { $t.p.dataProxy.call($t, ajaxOptions, "del_"+$t.p.id); }
else { $.ajax(ajaxOptions); }
}
}
if(ret[0] === false) {
$("#DelError>td","#"+dtbl).html(ret[1]);
$("#DelError","#"+dtbl).show();
}
return false;
});
$("#eData", "#"+dtbl+"_2").click(function(e){
$.jgrid.hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:p.jqModal, onClose: rp_ge.onClose});
return false;
});
if(onBeforeShow) { p.beforeShowForm($("#"+dtbl)); }
$.jgrid.viewModal("#"+IDs.themodal,{gbox:"#gbox_"+gID,jqm:p.jqModal, overlay: p.overlay, modal:p.modal});
if(onAfterShow) { p.afterShowForm($("#"+dtbl)); }
}
if(p.closeOnEscape===true) {
setTimeout(function(){$(".ui-jqdialog-titlebar-close","#"+IDs.modalhead).focus();},0);
}
});
},
navGrid : function (elem, o, pEdit,pAdd,pDel,pSearch, pView) {
o = $.extend({
edit: true,
editicon: "ui-icon-pencil",
add: true,
addicon:"ui-icon-plus",
del: true,
delicon:"ui-icon-trash",
search: true,
searchicon:"ui-icon-search",
refresh: true,
refreshicon:"ui-icon-refresh",
refreshstate: 'firstpage',
view: false,
viewicon : "ui-icon-document",
position : "left",
closeOnEscape : true,
beforeRefresh : null,
afterRefresh : null,
cloneToTop : false
}, $.jgrid.nav, o ||{});
return this.each(function() {
var alertIDs = {themodal:'alertmod',modalhead:'alerthd',modalcontent:'alertcnt'},
$t = this, vwidth, vheight, twd, tdw;
if(!$t.grid || typeof elem != 'string') { return; }
if ($("#"+alertIDs.themodal).html() === null) {
if (typeof window.innerWidth != 'undefined') {
vwidth = window.innerWidth;
vheight = window.innerHeight;
} else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth !== 0) {
vwidth = document.documentElement.clientWidth;
vheight = document.documentElement.clientHeight;
} else {
vwidth=1024;
vheight=768;
}
$.jgrid.createModal(alertIDs,"<div>"+o.alerttext+"</div><span tabindex='0'><span tabindex='-1' id='jqg_alrt'></span></span>",{gbox:"#gbox_"+$t.p.id,jqModal:true,drag:true,resize:true,caption:o.alertcap,top:vheight/2-25,left:vwidth/2-100,width:200,height:'auto',closeOnEscape:o.closeOnEscape},"","",true);
}
var clone = 1;
if(o.cloneToTop && $t.p.toppager) { clone = 2; }
for(var i = 0; i<clone; i++) {
var tbd,
navtbl = $("<table cellspacing='0' cellpadding='0' border='0' class='ui-pg-table navtable' style='float:left;table-layout:auto;'><tbody><tr></tr></tbody></table>"),
sep = "<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>",
pgid, elemids;
if(i===0) {
pgid = elem;
elemids = $t.p.id;
if(pgid == $t.p.toppager) {
elemids += "_top";
clone = 1;
}
} else {
pgid = $t.p.toppager;
elemids = $t.p.id+"_top";
}
if($t.p.direction == "rtl") { $(navtbl).attr("dir","rtl").css("float","right"); }
if (o.add) {
pAdd = pAdd || {};
tbd = $("<td class='ui-pg-button ui-corner-all'></td>");
$(tbd).append("<div class='ui-pg-div'><span class='ui-icon "+o.addicon+"'></span>"+o.addtext+"</div>");
$("tr",navtbl).append(tbd);
$(tbd,navtbl)
.attr({"title":o.addtitle || "",id : pAdd.id || "add_"+elemids})
.click(function(){
if (!$(this).hasClass('ui-state-disabled')) {
if (typeof o.addfunc == 'function') {
o.addfunc();
} else {
$($t).jqGrid("editGridRow","new",pAdd);
}
}
return false;
}).hover(
function () {
if (!$(this).hasClass('ui-state-disabled')) {
$(this).addClass("ui-state-hover");
}
},
function () {$(this).removeClass("ui-state-hover");}
);
tbd = null;
}
if (o.edit) {
tbd = $("<td class='ui-pg-button ui-corner-all'></td>");
pEdit = pEdit || {};
$(tbd).append("<div class='ui-pg-div'><span class='ui-icon "+o.editicon+"'></span>"+o.edittext+"</div>");
$("tr",navtbl).append(tbd);
$(tbd,navtbl)
.attr({"title":o.edittitle || "",id: pEdit.id || "edit_"+elemids})
.click(function(){
if (!$(this).hasClass('ui-state-disabled')) {
var sr = $t.p.selrow;
if (sr) {
if(typeof o.editfunc == 'function') {
o.editfunc(sr);
} else {
$($t).jqGrid("editGridRow",sr,pEdit);
}
} else {
$.jgrid.viewModal("#"+alertIDs.themodal,{gbox:"#gbox_"+$t.p.id,jqm:true});
$("#jqg_alrt").focus();
}
}
return false;
}).hover(
function () {
if (!$(this).hasClass('ui-state-disabled')) {
$(this).addClass("ui-state-hover");
}
},
function () {$(this).removeClass("ui-state-hover");}
);
tbd = null;
}
if (o.view) {
tbd = $("<td class='ui-pg-button ui-corner-all'></td>");
pView = pView || {};
$(tbd).append("<div class='ui-pg-div'><span class='ui-icon "+o.viewicon+"'></span>"+o.viewtext+"</div>");
$("tr",navtbl).append(tbd);
$(tbd,navtbl)
.attr({"title":o.viewtitle || "",id: pView.id || "view_"+elemids})
.click(function(){
if (!$(this).hasClass('ui-state-disabled')) {
var sr = $t.p.selrow;
if (sr) {
$($t).jqGrid("viewGridRow",sr,pView);
} else {
$.jgrid.viewModal("#"+alertIDs.themodal,{gbox:"#gbox_"+$t.p.id,jqm:true});
$("#jqg_alrt").focus();
}
}
return false;
}).hover(
function () {
if (!$(this).hasClass('ui-state-disabled')) {
$(this).addClass("ui-state-hover");
}
},
function () {$(this).removeClass("ui-state-hover");}
);
tbd = null;
}
if (o.del) {
tbd = $("<td class='ui-pg-button ui-corner-all'></td>");
pDel = pDel || {};
$(tbd).append("<div class='ui-pg-div'><span class='ui-icon "+o.delicon+"'></span>"+o.deltext+"</div>");
$("tr",navtbl).append(tbd);
$(tbd,navtbl)
.attr({"title":o.deltitle || "",id: pDel.id || "del_"+elemids})
.click(function(){
if (!$(this).hasClass('ui-state-disabled')) {
var dr;
if($t.p.multiselect) {
dr = $t.p.selarrrow;
if(dr.length===0) { dr = null; }
} else {
dr = $t.p.selrow;
}
if(dr){
if("function" == typeof o.delfunc){
o.delfunc(dr);
}else{
$($t).jqGrid("delGridRow",dr,pDel);
}
} else {
$.jgrid.viewModal("#"+alertIDs.themodal,{gbox:"#gbox_"+$t.p.id,jqm:true}); $("#jqg_alrt").focus();
}
}
return false;
}).hover(
function () {
if (!$(this).hasClass('ui-state-disabled')) {
$(this).addClass("ui-state-hover");
}
},
function () {$(this).removeClass("ui-state-hover");}
);
tbd = null;
}
if(o.add || o.edit || o.del || o.view) { $("tr",navtbl).append(sep); }
if (o.search) {
tbd = $("<td class='ui-pg-button ui-corner-all'></td>");
pSearch = pSearch || {};
$(tbd).append("<div class='ui-pg-div'><span class='ui-icon "+o.searchicon+"'></span>"+o.searchtext+"</div>");
$("tr",navtbl).append(tbd);
$(tbd,navtbl)
.attr({"title":o.searchtitle || "",id:pSearch.id || "search_"+elemids})
.click(function(){
if (!$(this).hasClass('ui-state-disabled')) {
$($t).jqGrid("searchGrid",pSearch);
}
return false;
}).hover(
function () {
if (!$(this).hasClass('ui-state-disabled')) {
$(this).addClass("ui-state-hover");
}
},
function () {$(this).removeClass("ui-state-hover");}
);
tbd = null;
}
if (o.refresh) {
tbd = $("<td class='ui-pg-button ui-corner-all'></td>");
$(tbd).append("<div class='ui-pg-div'><span class='ui-icon "+o.refreshicon+"'></span>"+o.refreshtext+"</div>");
$("tr",navtbl).append(tbd);
$(tbd,navtbl)
.attr({"title":o.refreshtitle || "",id: "refresh_"+elemids})
.click(function(){
if (!$(this).hasClass('ui-state-disabled')) {
if($.isFunction(o.beforeRefresh)) { o.beforeRefresh(); }
$t.p.search = false;
try {
var gID = $t.p.id;
$("#fbox_"+gID).searchFilter().reset({"reload":false});
if($.isFunction($t.clearToolbar)) { $t.clearToolbar(false); }
} catch (e) {}
switch (o.refreshstate) {
case 'firstpage':
$($t).trigger("reloadGrid", [{page:1}]);
break;
case 'current':
$($t).trigger("reloadGrid", [{current:true}]);
break;
}
if($.isFunction(o.afterRefresh)) { o.afterRefresh(); }
}
return false;
}).hover(
function () {
if (!$(this).hasClass('ui-state-disabled')) {
$(this).addClass("ui-state-hover");
}
},
function () {$(this).removeClass("ui-state-hover");}
);
tbd = null;
}
tdw = $(".ui-jqgrid").css("font-size") || "11px";
$('body').append("<div id='testpg2' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:"+tdw+";visibility:hidden;' ></div>");
twd = $(navtbl).clone().appendTo("#testpg2").width();
$("#testpg2").remove();
$(pgid+"_"+o.position,pgid).append(navtbl);
if($t.p._nvtd) {
if(twd > $t.p._nvtd[0] ) {
$(pgid+"_"+o.position,pgid).width(twd);
$t.p._nvtd[0] = twd;
}
$t.p._nvtd[1] = twd;
}
tdw =null; twd=null; navtbl =null;
}
});
},
navButtonAdd : function (elem, p) {
p = $.extend({
caption : "newButton",
title: '',
buttonicon : 'ui-icon-newwin',
onClickButton: null,
position : "last",
cursor : 'pointer'
}, p ||{});
return this.each(function() {
if( !this.grid) { return; }
if( elem.indexOf("#") !== 0) { elem = "#"+elem; }
var findnav = $(".navtable",elem)[0], $t = this;
if (findnav) {
var tbd = $("<td></td>");
if(p.buttonicon.toString().toUpperCase() == "NONE") {
$(tbd).addClass('ui-pg-button ui-corner-all').append("<div class='ui-pg-div'>"+p.caption+"</div>");
} else {
$(tbd).addClass('ui-pg-button ui-corner-all').append("<div class='ui-pg-div'><span class='ui-icon "+p.buttonicon+"'></span>"+p.caption+"</div>");
}
if(p.id) {$(tbd).attr("id",p.id);}
if(p.position=='first'){
if(findnav.rows[0].cells.length ===0 ) {
$("tr",findnav).append(tbd);
} else {
$("tr td:eq(0)",findnav).before(tbd);
}
} else {
$("tr",findnav).append(tbd);
}
$(tbd,findnav)
.attr("title",p.title || "")
.click(function(e){
if (!$(this).hasClass('ui-state-disabled')) {
if ($.isFunction(p.onClickButton) ) { p.onClickButton.call($t,e); }
}
return false;
})
.hover(
function () {
if (!$(this).hasClass('ui-state-disabled')) {
$(this).addClass('ui-state-hover');
}
},
function () {$(this).removeClass("ui-state-hover");}
);
}
});
},
navSeparatorAdd:function (elem,p) {
p = $.extend({
sepclass : "ui-separator",
sepcontent: ''
}, p ||{});
return this.each(function() {
if( !this.grid) { return; }
if( elem.indexOf("#") !== 0) { elem = "#"+elem; }
var findnav = $(".navtable",elem)[0];
if(findnav) {
var sep = "<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='"+p.sepclass+"'></span>"+p.sepcontent+"</td>";
$("tr",findnav).append(sep);
}
});
},
GridToForm : function( rowid, formid ) {
return this.each(function(){
var $t = this;
if (!$t.grid) { return; }
var rowdata = $($t).jqGrid("getRowData",rowid);
if (rowdata) {
for(var i in rowdata) {
if ( $("[name="+i+"]",formid).is("input:radio") || $("[name="+i+"]",formid).is("input:checkbox")) {
$("[name="+i+"]",formid).each( function() {
if( $(this).val() == rowdata[i] ) {
$(this).attr("checked","checked");
} else {
$(this).attr("checked","");
}
});
} else {
// this is very slow on big table and form.
$("[name="+i+"]",formid).val(rowdata[i]);
}
}
}
});
},
FormToGrid : function(rowid, formid, mode, position){
return this.each(function() {
var $t = this;
if(!$t.grid) { return; }
if(!mode) { mode = 'set'; }
if(!position) { position = 'first'; }
var fields = $(formid).serializeArray();
var griddata = {};
$.each(fields, function(i, field){
griddata[field.name] = field.value;
});
if(mode=='add') { $($t).jqGrid("addRowData",rowid,griddata, position); }
else if(mode=='set') { $($t).jqGrid("setRowData",rowid,griddata); }
});
}
});
})(jQuery);
| zzh-simple-hr | ZJs/webapp/grid/jqgrid/3.8.2/src/grid.formedit.js | JavaScript | art | 77,563 |