The question is close to the other question which I answered recently. The distinguish is that you want to search for a selected column. For case-sensitive searching you can use following code
var index = 3;
var str = 'b';
$("#list > tbody > tr > td:nth-child("+index+"):contains('" + str + "')").parent();
For case-insensitive searching the code could look like
var index = 3;
var str = 'b';
var cells = $("#list > tbody > tr > td:nth-child(3)").filter(function() {
return re.test( $(this).text());
});
var rows = cells.parent();
It is important to take in consideration that jqGrid has sometimes additional columns before the columns declared in the colModel
. This is 'rn' column contains row numbers. It exists if you use rownumbers: true
option of jqGrid. In you use the option multiselect: true
there are also 'cb' column with check-boxes. You can hide the column with respect of $('#list').jqGrid('hideCol', 'cb');
, but you should calculate there also. In general you should calculate all hidden columns.
You can see all live in the following small demo.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…