Hi,
I am not able to perform the search activity in the jqGrid. Can someone guide on whether do I need to write a separate SQL query. Currently I am using the below code
$(function(){
$(“#list”).jqGrid({
url:gridReload(),
datatype: 'xml',
mtype: 'POST',
colNames:['ID','Visible', 'Question Title','Type','Question Hint','Answer','Explanation','File Type', 'File Name'],
colModel :[
//{name: 'myac', width:50, fixed:true, sortable:false, resize:false, formatter:'actions', formatoptions:{keys:true}},
{name:'PK_QuestionTitleID', index:'PK_QuestionTitleID', width:55, sortable:true, align:'center'},
{name:'IsQuestionTitleActive', index:'IsQuestionTitleActive', width:50, sortable:true, align:'center'},
{name:'QuestionTitle', index:'QuestionTitle', width:200, align:'left', sortable:true},
{name:'AnswerOptionType', index:'AnswerOptionType', width:50, align:'center', sortable:true},
{name:'QuestionHint', index:'QuestionHint', width:150, align:'left'},
{name:'CorrectAnswers', index:'CorrectAnswers', width:150, sortable:true},
{name:'CorrectAnswerExplanation', index:'CorrectAnswerExplanation', width:150, sortable:true},
{name:'QuestionFileType', index:'QuestionFileType', width:60, sortable:true, align:'center'},
{name:'QuestionFileName', index:'QuestionFileName', width:120, sortable:false, align:'center'}
],
rowNum:2,
rowList:[10,20,30],
pager: '#pager',
sortname: 'PK_QuestionTitleID',
sortorder: 'asc',
viewrecords: true,
gridview: true,
caption: 'My First grid',
multiselect: false,
subgrid: true,
autowidth: true,
autosearch: true,
height: 300
}).navGrid('#pager',{edit:true,add:true,del:false, search:false})
// this function is to retrieve the value from the Grid
jQuery(“#a1”).click( function(){
var id = jQuery(“#list”).jqGrid('getGridParam','selrow');
if (id) {
var ret = jQuery(“#list”).jqGrid('getRowData',id);
alert(“id=”+ret.PK_QuestionTitleID+” invdate=”+escape(ret.QuestionTitle)+”…”);
} else { alert(“Please select row”);}
});
// this function is to call search box
jQuery(“#bsdata”).click(function(){
jQuery(“#list”).jqGrid('searchGrid',
{sopt:['cn','bw','eq','ne','lt','gt','ew']}
);
});
// this function is to show the searchboxes on top of the grid
jQuery(“#list”).jqGrid('filterToolbar','');
});
function gridReload()
{
var cd_mask = jQuery(“#ProgramName”).val();
jQuery(“#list”).jqGrid('setGridParam',{url:”fetchquestionsdata.asp?prid=”+cd_mask+”&q=1″,page:1}).trigger(“reloadGrid”);
}
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top