jQuery의 tablesorter
과 결합하여 GridView의 스타일을 변경하여 행 색상을 교대로 지정할 수 있지만 각 열 그룹에 대한 색상 세트를 변경 할 수 있습니까?열 그룹 색상을 사용하여 행 색상을 교대로 추가 할 수 있습니까?
나는 현재 내가 만든 배열에 따라 셀 배경 색상, 예를 하드 코딩 해요 : 아래 이미지 참조 greenArray는 (0,1,2,3)으로 설정된 정수 배열이고 purpleArray는 (4,5,6,7) 등입니다. 그러나 Tablesorter 플러그인을 사용하면 분명히 셀이 색상을 유지합니다. 교류 색상 :
편집 : 나는 현재 VB.NET에 배경 색상을 추가 해요. 다음 함수는 배열을 정의하고 실제로 스타일 적용 ColorizeMe() 함수를 호출 :
Private Sub StyleTable(ByVal sender As Object, ByVal e As GridViewRowEventArgs) Handles gvReport.RowDataBound
'Define arrays to color the gridview, if cell index is in array, it will be colored
Dim blueArray() As Integer = {0, 17, 18, 19, 20}
Dim greenArray() As Integer = {1, 2, 3, 4}
Dim purpleArray() As Integer = {5, 6, 7, 8}
Dim pinkArray() As Integer = {9, 10, 11, 12}
Dim yellowArray() As Integer = {13, 14, 15, 16}
_packworks.ColorizeMe(blueArray, greenArray, purpleArray, pinkArray, yellowArray, e.Row)
End Sub
그리고 ColorizeMe() 함수 : 당신의 행 이후
Public Sub ColorizeMe(ByVal blueArray() As Integer, ByVal greenArray() As Integer, _
ByVal purpleArray() As Integer, ByVal pinkArray() As Integer, _
ByVal yellowArray() As Integer, ByVal row As GridViewRow)
Dim i As Integer = 0
For Each cell As TableCell In row.Cells
If Array.IndexOf(blueArray, i) <> -1 Then
If _isDark Then 'Color account column
cell.BackColor = ColorTranslator.FromHtml("#B0C4DE")
Else
cell.BackColor = ColorTranslator.FromHtml("#E6E6FA")
End If
ElseIf Array.IndexOf(greenArray, i) <> -1 Then
If _isDark Then
cell.BackColor = ColorTranslator.FromHtml("#a4d5a8")
Else
cell.BackColor = ColorTranslator.FromHtml("#ddf5de")
End If
ElseIf Array.IndexOf(purpleArray, i) <> -1 Then
If _isDark Then
cell.BackColor = ColorTranslator.FromHtml("#ada4d4")
Else
cell.BackColor = ColorTranslator.FromHtml("#c7c6f4")
End If
ElseIf Array.IndexOf(pinkArray, i) <> -1 Then
If _isDark Then
cell.BackColor = ColorTranslator.FromHtml("#e3b3e0")
Else
cell.BackColor = ColorTranslator.FromHtml("#fae1fa")
End If
ElseIf Array.IndexOf(yellowArray, i) <> -1 Then
If _isDark Then
cell.BackColor = ColorTranslator.FromHtml("#e0e3ab")
Else
cell.BackColor = ColorTranslator.FromHtml("#f5f8dd")
End If
End If
i += 1
Next
_isDark = Not _isDark
End Sub
해당 코드를 피할 수 있습니까? 가능하지만 현재 작업하고있는 것을 더 쉽게 볼 수 있습니다. –
나는 바이올린을 게시 할 수 있으면 좋겠다. 저는 현재 서버 측에서 .NET의 색상 배경을 추가하고 있습니다. 언어에 대한 지식이 거의없는 jQuery에서 동일한 기능을 수행 할 수 있는지 궁금했습니다. 그러나 내 생각에 대한 통찰력을 얻는 데 도움이된다면 설명에 서버 측 코드를 추가했습니다. 색상이 필요한 다양한 열이있는 여러 페이지가 있으므로 해당 배열이 최선의 선택이라고 생각했습니다. – TimeBomb006