1.首先嘗試在jqgrid的初始化的時候 添加
gridComplete : function(){
//$("#airlineList").setJgridRowCSS();
}
$.fn.extend( {
setJgridRowCSS : function() {
var self = this;
$("tr:even", $(self)).addClass("normalEvenTD"); // 從標頭行下一行開始的奇數行,行數:(1,3,5...)
$("tr:odd", $(self)).addClass("normalOddTD"); // 從標頭行下一行開始的偶數行,行數:(2,4,6...)
// 鼠標經過的行變色
$("tr", $(self)).hover(function() {
$(this).addClass('hoverTD');
$(this).removeClass('table-td-content');
}, function() {
$(this).removeClass('hoverTD');
$(this).addClass('table-td-content');
});
// 選擇行變色
$("tr", $(self)).click(function() {
var trThis = this;
$(self).find(".trSelected").removeClass('trSelected');
if ($(trThis).get(0) == $("tr:first", $(self)).get(0)) {
return;
}
$(trThis).addClass('trSelected');
});
}
});
2.用火狐查找選中行的class,發現這個比較特殊ui-state-highlight,就去搜索這個css在哪里,找到:jquery-ui.min.css
然后百般修改這個
.ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight{
border: 1px solid #fad42e;
background: #fef1ec url(../images/jqgrid/c3/ui-bg_flat_55_fbec88_40x100.png) 50% 50% repeat-x ;
color: #363636;
}里面的
background屬性顏色都沒用;
最后在http://stackoverflow.com/questions/4305223/selected-row-background-color
找到一個答案:直接background: #A2A25E;
坑爹,原來是這個背景圖片在搞鬼么,害我調了老久老久