Click here to Skip to main content
15,910,981 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,
I wanted to change color of my jqGrid on rowSelect(with my custom colors).
How to change color of jqgrid on row highlighting , for this one i am getting confusion how to start.

i tried thid code for row select.

onSelectRow: function(id){
    var rowData = $(this).getRowData(id);
   // if(id!==lastSel){
          $(this).find('.ui-state-highlight').css({background:'#80BFFF'});
          lastSel=id;
     //}
 },



if i click on row1 its highlighting then i click row2 its also highlighting.
then how to change color of specific row onSelectRow and hover.
if i am trying to get "lastSel" value i am getting error.
Is there any alternative to do this?
Posted
Updated 26-Aug-13 20:50pm
v2

1 solution

First problem: Change the color of the grid onClick.


XML
onSelectRow: function() {
      //HERE PUT THE DEFAULT COLOR (I PRESUME THAT IS WHITE)
      //YOU SHOULD SELECT BY JQUERY ALL ROWS
      $('table tr').find('.ui-state-highlight').css('background', '#ffffff');
      $(this).find('.ui-state-highlight').css('background', '#80BFFF');
},



What you should do is something like that above, first put the old color in every row and then put the new color in the selected row.
 
Share this answer
 
v3
Comments
Naga Sindhura 28-Aug-13 2:12am    
Hi, how to apply same property on tabs ?
hh_7 28-Aug-13 4:34am    
What do you mean? (code?)
Naga Sindhura 5-Sep-13 1:36am    
yes, about the code.
hh_7 6-Sep-13 6:15am    
Probably the same way, if you have troubles doing that, post the code

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