Android Question B4XTable Change Column Title

MList

Member
Licensed User
Hi,
I would like to change the Column title in B4XTable, according to change of language.
Here my example of changen "Nr" to "No"
in Attached files you can see, the title changed but my in my dispay of table it is still the old one after refresh.
Please helpšŸ˜³

B4X:
    Dim NrCol As B4XTableColumn  = TabData.AddColumn("Nr", TabData.COLUMN_TYPE_NUMBERS)
    NrCol.Width = 15%x
    Dim SchichtCol As B4XTableColumn = TabData.AddColumn("Schicht", TabData.COLUMN_TYPE_TEXT)
    SchichtCol.Width = 35%x
    Dim EinheitCol As B4XTableColumn = TabData.AddColumn("Einheit", TabData.COLUMN_TYPE_TEXT)
    EinheitCol.Width = 15%x
    Dim MaterialCol As B4XTableColumn = TabData.AddColumn("Metall", TabData.COLUMN_TYPE_TEXT)
    MaterialCol.Width = 15%x
    Dim LimCol As B4XTableColumn = TabData.AddColumn("Lim", TabData.COLUMN_TYPE_TEXT)
    LimCol.Width = 20%x
    
    
Public Sub B4XPage_Appear
Dim col As B4XTableColumn
B4XPages.MainPage.currentPage = Me
PLayout1.SetMenuColor


btnSpeicher.Text = Language.Text(Var.v,85)
btnAkt.Text = Language.Text(Var.v,80)
btnDelTab.Text = Language.Text(Var.v, 5)
lblwait.Text =Language.Text(Var.v,54)
lblAnz.Text = Language.Text(Var.v,51)

If TabData.IsInitialized Then
    col = TabData.GetColumn("Nr")
    Log(col.Title)
    col.title  = "NO"
    Log(col.Title)
    TabData.Refresh
    col = TabData.GetColumn("Nr")
    Log(col.Title)
End If
 

Attachments

  • B4XTab2.jpg
    B4XTab2.jpg
    156.2 KB · Views: 101
  • B4XTab.jpg
    B4XTab.jpg
    376.3 KB · Views: 100

Mahares

Expert
Licensed User
Longtime User
would like to change the Column title in B4XTable, according to change of language.
Here my example of changen "Nr" to "No"
You can change the header name from Nr to No and vice versa using this code.
B4X:
If B4XTable1.IsInitialized Then
        col = B4XTable1.GetColumn("Nr")
        Log(col.Title)
        Dim pnl As B4XView = col.CellsLayouts.Get(0)
        pnl.GetView(0).Text= "No"  'the column header only changes to No. col.title remains the same            
    End If
To change the col title, I think you have to redefine the B4Xtable columns structure.
 
Upvote 0
Top