2010-06-08 6 views
1

방금 ​​jQuery를 시작했습니다. 내 jqGrid 클래스에서 얼룩말 스트라이핑을 구현하려고합니다. 사용자가 정렬 열을 클릭하면 모든 행이 다시 정렬되고 얼룩말 줄무늬가 날아가 버리는 문제가 있습니다.JQGrid 제브라 스트라이핑 문제

얼룩말 스트라이핑 코드

$("#item_table tbody tr:odd").addClass("alt"); 
$("#item_table tbody tr").mouseover(function() { 
    $(this).addClass("over"); 
}); 
$("#item_table tbody tr").mouseout(function() { 
    $(this).removeClass("over"); 
}); 

있는 jqGrid 코드

jQuery.extend(jQuery.jgrid.defaults, { 
    autowidth: true, 
    hidegrid: false, 
    colModel:[ 
    { name: 'icon', index: 'icon', width: 0, resizable: false }, 
    { name: 'name', index: 'name', width: 0, resizable: false }, 
    { name: 'price', index: 'price', width: 0, sorttype: "int", resizable: false } 
    ], 
    onSortCol: function(index, iCol, sortorder) { 
       // This doesn't work - IT SHOULDN'T EITHER, since event is called 
       // just after clicking to sort but before actual sorting 
       jQuery("#item_table tbody tr:odd").addClass("odd"); 
    }, 
    caption: "Item Table" 
}); 

나는 또한 loadComplete, gridComplete 이벤트를 시도했지만 아무 소용.

어떻게해야합니까? 나는이 권리를 시작 했는가?

감사 비 크람은

답변

3

altRowsaltclasswiki

+0

같은 문제가 여전히 존재에서 옵션을 속성을보십시오. 정렬 할 때 얼룩말 줄무늬가 혼합되어 이벤트 onSortCol에서 그리드를 다시로드하더라도 정렬 순서가 다시로드 될 때 유지되지 않습니다. – vikmalhotra