I want help in highlighting jqgrid row's data part as and when they are matched.
My jqGrid markup:
<div title="Environment variables">
<div class="jqUIDiv">
<table id="tblEnvvars" width="100%"></table>
<div id="EnvvarsGridpager"></div>
</div>
</div>'
And my jqGrid code:
var envVars=[]; //xml is a xml response sent from server
$(xml).children('product').each(function(){
$(this).children('envvars').each(function(){
$(this).children('variable').each(function(){
var row={};
isPresent=true;
row.name=$(this).attr('name');
row.value=$(this).attr('value');
envVars.push(row);
});
});
});
jQuery("#tblEnvvars").jqGrid({
datatype: "local",
data: envVars,
colNames:['Name','Value'],
colModel:[
{name:'name',index:'name', align:"left"},
{name:'value',index:'value', align:"left"}
],
pager : '#EnvvarsGridpager',
rowNum:10,
rowList:[10,50,100],
scrollOffset:0,
height: 'auto',
autowidth:true,
viewrecords: true,
gridview: true
});
jQuery("#tblEnvvars").setGridParam({rowNum:10}).trigger("reloadGrid");
jQuery("#tblEnvvars").jqGrid('filterToolbar',{stringResult: true, searchOnEnter: false, defaultSearch: 'cn'});
for example:
if a row item contains LD_LIBRARY_PATH
and user types in LIB
in search area, then LIB
in LD_LIBRARY_PATH should get highlighted.
Update: 15/12/2011
I found this Highlight plugin to highlight but need help in applying it.
I used it to create the below screenshot
Here is the code i used
jQuery("#list1").jqGrid('filterToolbar',{stringResult: true, searchOnEnter: false, defaultSearch: 'cn', afterSearch:highlightIt()});
function highlightIt()
{
$('#list1 > tbody > tr > td').highlight('HOST');
}
filterToolbar
docs trirand.com/jqgridwiki/doku.php?id=wiki:toolbar_searching - it looks likebeforeSearch
might be a good event to hook in your highlight plugin. – Eikon