Sorry, I missed that local datatype detail. I understand now, thank you. What I wanted was to select all rows with the multiselect. What I did to solve this issue was to add an “All” option to the pager count dropdown, so user can show all rows in grid, then perform theĀ select all.
It doesn’t seem to work, as it results in 0 rows being selected. Am I missing something? Here is an example using the one from the guriddo sitem using a button “btnSelect”:
<!DOCTYPE html>
<html lang=”en”>
<head>
<script type=”text/ecmascript” src=”http://www.guriddo.net/demo/js/jquery.min.js”></script>
<script type=”text/ecmascript” src=”http://www.guriddo.net/demo/js/trirand/i18n/grid.locale-en.js”></script>
<script type=”text/ecmascript” src=”http://www.guriddo.net/demo/js/trirand/jquery.jqGrid.min.js”></script>
<link rel=”stylesheet” type=”text/css” media=”screen” href=”http://www.guriddo.net/demo/css/jquery-ui.css” />
<!– The link to the CSS that the grid needs –>
<link rel=”stylesheet” type=”text/css” media=”screen” href=”http://www.guriddo.net/demo/css/trirand/ui.jqgrid.css” />
<meta charset=”utf-8″ />
<title>jqGrid Loading Data – Million Rows from a REST service</title>
</head>
<body>
<table id=”jqGrid”></table>
<script type=”text/javascript”>
$(document).ready(function() {
$(“#jqGrid”).jqGrid({
url: ‘http://trirand.com/blog/phpjqgrid/examples/jsonp/getjsonp.php?callback=?&qwery=longorders’,
mtype: “GET”,
datatype: “jsonp”,
colModel: [{
label: ‘OrderID’,
name: ‘OrderID’,
key: true,
width: 75
},
{
label: ‘Customer ID’,
name: ‘CustomerID’,
width: 150
},
{
label: ‘Order Date’,
name: ‘OrderDate’,
width: 150,
formatter: ‘date’,
formatoptions: {
srcformat: ‘Y-m-d H:i:s’,
newformat: ‘ShortDate’
}
},
{
label: ‘Freight’,
name: ‘Freight’,
width: 150
},
{
label: ‘Ship Name’,
name: ‘ShipName’,
width: 150
}
],
viewrecords: true,
width: 780,
height: 250,
multiselect: true,
rowNum: 20,
pager: jqGridPager
});
$(“#btnSelect”).click(function(){
var indexes = $(“#jqGrid”).jqGrid(‘getGridParam’,’_index’);
var arr=[];
for(var key in indexes) {
$(“#jqGrid”).jqGrid(‘setSelection’,key, true);
arr.push(key);
}
$(“#jqGrid”).jqGrid(‘setGridParam’,{ ‘selarrrow’ : arr});
var selectedIDs = $(“#jqGrid”).getGridParam(“selarrrow”);
alert(selectedIDs.length);
});
});
</script>
<input id=”btnSelect” class=”btn btn-default” type=”button” value=”Select All Rows” />
</body>
</html>
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top