B4J Question TableView - change background of first column

DarkoT

Active Member
Licensed User
Hi,
please help... I want to change background of FIRST CELL in header of tableview. With next code I can change last added column; I can not find logic how to get FIRST CELL OF HEADER in tableview. Can somebody help me? Thx...

Code:
Code:
Private Sub SetFilterStyle(Index As Int, Color As String)
    
    Dim Style As String = " -fx-background-color: " & Color & ";"
    If Color = "" Then Style = ""
    Dim jo As JavaObject = tblView
    Dim columnHeader As JavaObject = jo.RunMethodJO("lookup", Array(".column-header-background"))
    Dim firstCell As JavaObject = columnHeader.RunMethodJO("getChildren", Null).RunMethod("get", Array(Index))
    firstCell.RunMethod("setStyle", Array(Style))
End Sub
 
Solution
Hi,
please help... I want to change background of FIRST CELL in header of tableview. With next code I can change last added column; I can not find logic how to get FIRST CELL OF HEADER in tableview. Can somebody help me? Thx...

Code:
Code:
Private Sub SetFilterStyle(Index As Int, Color As String)
   
    Dim Style As String = " -fx-background-color: " & Color & ";"
    If Color = "" Then Style = ""
    Dim jo As JavaObject = tblView
    Dim columnHeader As JavaObject = jo.RunMethodJO("lookup", Array(".column-header-background"))
    Dim firstCell As JavaObject = columnHeader.RunMethodJO("getChildren", Null).RunMethod("get", Array(Index))
    firstCell.RunMethod("setStyle", Array(Style))
End Sub
I found the solution - if...

DarkoT

Active Member
Licensed User
Hi,
please help... I want to change background of FIRST CELL in header of tableview. With next code I can change last added column; I can not find logic how to get FIRST CELL OF HEADER in tableview. Can somebody help me? Thx...

Code:
Code:
Private Sub SetFilterStyle(Index As Int, Color As String)
   
    Dim Style As String = " -fx-background-color: " & Color & ";"
    If Color = "" Then Style = ""
    Dim jo As JavaObject = tblView
    Dim columnHeader As JavaObject = jo.RunMethodJO("lookup", Array(".column-header-background"))
    Dim firstCell As JavaObject = columnHeader.RunMethodJO("getChildren", Null).RunMethod("get", Array(Index))
    firstCell.RunMethod("setStyle", Array(Style))
End Sub
I found the solution - if somebody will need this...

Example:
Private Sub SetFilterStyle(Index As Int, Color As String)
    Dim Style As String = " -fx-background-color: " & Color & ";"
    If Color = "" Then Style = ""

    Dim jo As JavaObject = tblView
    Dim Column As JavaObject = jo.RunMethodJO("getColumns", Null).RunMethod("get", Array(Index))
    Column.RunMethod("setStyle", Array(Style))
End Sub
 
Upvote 1
Solution
Top