Hi,
Sorting is not happening on the click of column headers. The "Loading..." shows up briefly over the data, but the columns are not getting sorted. Also, "OnSortCol" event gets triggered and I could see the alert popping up. But, the sorting is not happening. Any help on this is appreciated.
Please find below the code:
jQuery("#jqTable").jqGrid({
dataType: 'local',
altRows: true,
colNames: ["ID", "First name", "Last name", "Role", "Group", "Location", "Status", "<div class='selectgriddiv'>Select all</div>" + "<div class='selectgriddiv'><input type='checkbox' id='chkAll' name = 'chkSelectAll' onclick='checkBox(event)' /></div>", "Role Id", "Is Primary"],
colModel: [
{
name: "Id", index: "Id", align: "center", sortable: false, formatter: function (cellvalue, options, rowObject) {
if (_RoleId > rowObject.RoleId && rowObject.IsPrimary == false)
return "<img src='../images/ProcessImages.aspx.jpg' alt='my image' />" + "<br/>" + "<a id='linkToProfile' href='#' onclick='RedirectUsers(" + rowObject.Id + "," + rowObject.RoleId + "," + '"' + rowObject.RoleName + '"' + ")' >" + rowObject.Id + "</a>";
else if (_RoleId == rowObject.RoleId || _RoleId < rowObject.RoleId) {
return "<img src='../images/ProcessImages.aspx.jpg' alt='my image' />" + "<br/>" + rowObject.Id;
}
else if (_RoleId == rowObject.RoleId && _IsPrimary == false) {
return "<img src='../images/ProcessImages.aspx.jpg' alt='my image' />" + "<br/>" + rowObject.Id;
}
}
},
{
name: "FirstName", index: "FirstName", sortable: true, align: "left"
},
{ name: "LastName", index: "LastName", sortable: true, align: "left" },
{
name: "RoleName", index: "RoleName", sortable: true, align: "left", formatter: function (cellvalue, options, rowObject) {
return rowObject.RoleName
}
},
{
name: "MyGroups", index: "MyGroups", sortable: true, align: "left", formatter: function (cellvalue, options, rowObject) {
if (rowObject.MyGroups != null)
return rowObject.MyGroups
else
return ""
}
},
{
name: "LocationName", index: "LocationName", sortable: false, align: "left", formatter: function (cellvalue, options, rowObject) {
if (rowObject.RegionName != null && rowObject.LOName != null && rowObject.CentreName != null) {
return rowObject.RegionName + '.<br/>' + rowObject.LOName + '.<br/>' + rowObject.CentreName
}
else if (rowObject.RegionName == null && rowObject.LOName != null && rowObject.CentreName != null) {
return rowObject.LOName + '.<br/>' + rowObject.CentreName
}
else if (rowObject.RegionName != null && rowObject.LOName == null && rowObject.CentreName != null) {
return rowObject.RegionName + '.<br/>' + rowObject.CentreName
}
else if (rowObject.RegionName != null && rowObject.LOName != null && rowObject.CentreName == null) {
return rowObject.RegionName + '.<br/>' + rowObject.LOName
}
else if (rowObject.RegionName != null && rowObject.LOName == null && rowObject.CentreName == null) {
return rowObject.RegionName
}
else if (rowObject.RegionName == null && rowObject.LOName != null && rowObject.CentreName == null) {
return rowObject.LOName
}
else if (rowObject.RegionName == null && rowObject.LOName == null && rowObject.CentreName != null) {
return rowObject.CentreName
}
else if (rowObject.RegionName == null && rowObject.LOName == null && rowObject.CentreName == null) {
return rowObject.LocationName
}
}
},
{
name: "StatusDetail", index: "StatusDetail", sortable: false, align: "left", formatter: function (cellvalue, options, rowObject) {
return rowObject.StatusDetail
}
},
{
name: "Select", index: "Select", sortable: false, align: "center", resizable: false, sortable: false, formatter: function (cellvalue, options, rowObject) {
return "<input type='checkbox' id='chkFields' " + rowObject.Id + " class='fieldChk' onclick='fieldCheckBox(event)'/>";
}
},
{
name: "RoleId", index: "RoleId", hidden: true, formatter: function (cellvalue, options, rowObject) {
return rowObject.RoleId
}
},
{
name: "IsPrimary", index: "IsPrimary", hidden: true, formatter: function (cellvalue, options, rowObject) {
return rowObject.IsPrimary
}
}
],
sortorder: "desc",
viewrecords: true,
width: 728,
height: 'auto',
onSortCol: function (name, index) {
alert(name);
}
});
Thanks,
B.R.S.K. Bharadwaj