Forum
14:19
26/07/2011
Hi,
I want to implement sorting on client side.
I have included loadonce true & also tried things that I found on web but none of them working for me.
Here is my code
<script type="text/javascript">
var lastrow;
$(function () {
$("#UsersGrid").jqGrid({
url: '../jqGridHandler.ashx?pname=mp',
datatype: 'json',
height: 'auto',
rowTotal: 100,
mtype: "GET",
colNames: ['ID', 'Name', 'Description', 'Price', 'IsActive', 'Edit'],
colModel: [
{ name: 'pid', index: 'ID', align: 'center', width: 50, sortable: true, sorttype: "int" },
{ name: 'name', width: 160, align: 'center', sortable: true, sorttype: "Text" },
{ name: 'description', width: 250, align: 'center', sortable: true, sorttype: "Text" },
{ name: 'price', width: 90, align: 'center', sortable: true, sorttype: "int" },
{ name: 'isActive', width: 50, align: 'center', sortable: false },
{ name: 'Edit', width: 50, align: 'center', sortable: false, edittype: 'select', formatter: 'showlink', formatoptions: { baseLinkUrl: 'CreatePackage.aspx', addParam: '&menuindex=1', idName: 'pid'} }
],
multiselect: false,
onSelectRow: function (id) {
if (id && id !== lastrow) {
jQuery('#UsersGrid').restoreRow(lastrow);
//jQuery('#UsersGrid').editRow(id, true);
lastrow = id;
}
},
loadComplete: function () {
$("#UsersGrid").setGridParam({ datatype: 'json' });
},
onPaging : function(which_button) {
$("#UsersGrid").setGridParam({ datatype: 'json' });
},
rowNum: 9,
rowList: [5, 10, 20, 30],
pager: '#UsersGridPager',
jsonReader: {
repeatitems: true
},
loadonce: true,
sortable: true,
viewrecords: true,
sortname: 'ID',
viewrecords: false,
sortorder: 'desc',
caption: 'Packages',
editurl: "../jqGridHandler.ashx?pname=mp"
});
$("#UsersGrid").jqGrid('navGrid', '#UsersGridPager', { edit: false, add: false, del: true, search: false },
{
closeAfterEdit: true,
reloadAfterSubmit: false
},
{
closeAfterAdd: true,
reloadAfterSubmit: false
},
{
beforeShowForm: function (formid) {
if (lastrow == 1) {
alert("This package can not be deleted.");
$("#" + formid).remove;
}
},
jqModal: false,
closeOnEscape: true,
reloadAfterSubmit: false
});
});
</script>
Most Users Ever Online: 715
Currently Online:
52 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66