0

I have a tree Grid where I want to provide for a Search facility and highlight the results in a tree. I looked at the link How to search for a row and then select it in jqGrid? and the same works fine.

However my Grid is a tree and as mentioned in the link Selecting multiple rows in jqGrid tree, MultiSelect:true option does not work. Hence when I search for a pattern, only the last row with the matching pattern is highlighted. I want to know how to highlight all the rows with the matching pattern.

The solution provided in the link Access jqgrid elements using a javascript suggests providing checkboxes to get a list of selected rows, but my requirement is to highlight the rows which satisfy the search result.

If this description is not sufficient, I will provide for my jqgrid definition, but I thought this is a generic issue and hence am currently not pasting the same.

Thanks much in advance

Community
  • 1
  • 1

2 Answers2

0

I changed the background color of the rows that match the search pattern and that served my purpose. Another link that helped me is - jQuery Highlight Effect with no fade away

Community
  • 1
  • 1
0

If you have the id's of the rows that have matches..

You can do..

//matchingRowIds

$.each(matchingRowIds, function(rowId, _){
    grid.setSelection(rowId); //or however it is that you're selecting the row
});

Note: Do not call resetSelection() whilst calling setSelection()

Robin Maben
  • 22,194
  • 16
  • 64
  • 99