Click here to Skip to main content
15,891,567 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Grid:
$(function () {
$("#PurposeTable").jqGrid({
ajaxGridOptions: { cache: false },
url: '../Handler/MaterialHandler.ashx?Mode=Purpose',
datatype: 'json',
contentType: 'application/json; charset=utf-8',
height: 250,
jsonReader: {
root: "rows",
page: "page",
total: "totalpages",
records: "totalrecords",
cell: "cell",
id: "id", //index of the column with the PK in it
userdata: "userdata",
repeatitems: false
},

colNames: ['Key', 'Select', 'Purpose Name', ],
colModel: [{ name: 'iKey', index: 'iKey', hidden: true, size: 10 },
{
name: 'iSelectBrand', index: 'iSelectBrand', width: 50, align: "center", editable: true, size: 10, edittype: "checkbox", editoptions: { value: "True:False" },
formatter: "checkbox", formatoptions: { disabled: false }
},
{ name: 'vcBrandName', index: 'vcBrandName', size: 10 }
],
ondblClickRow: function (id) {
// getRecordsforEdit();
},
rowNum: 1000,
rownumbers: true,
//pager: '#Relativemap',
ignoreCase: true, /* case insensitive search */
sortname: 'iId',
sortorder: "asc",
gridview: true,
viewrecords: true,
width: 250,
caption: 'Purpose Rights',
height: 250,
loadonce: true,
editurl: '../Handler/MaterialHandler.ashx?Mode=Purpose',
loadComplete: function (data) {

searchSubGridId("PurposeTable")
}
});
});


Code for search:

function searchSubGridId(tablename) {
try {

$('#' + tablename).jqGrid('filterToolbar', { defaultSearch: "cn", searchOnEnter: false, hight: "300px", enableClear: true });
var search = 'gs_';
var idCheckTester = new RegExp(search);
var count = document.getElementsByTagName("input");
var elm;
for (var i = 0; i < count.length; i++) {
elm = count[i];
if (idCheckTester.test(elm.id)) {
var searchId = elm.id;

// document.getElementById(searchId).className = "clsSearch";
document.getElementById(searchId).placeholder = "Search";
document.getElementById(searchId).style.height = "12px";
document.getElementById(searchId).style.left = "0px";
document.getElementById(searchId).style.position = "absolute";
}
}


}
catch (ex) {
document.location.href = 'frmSessionManager.html';
}
}
Posted
Updated 17-Nov-14 17:45pm
v2
Comments
Richard Deeming 17-Nov-14 9:59am    
Was there supposed to be a question hiding in that unformatted code-dump?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900