Android Question Tableview Sort Disable?

GGS

Member
Licensed User
Longtime User
I have developed an app that displays large amounts of data in a table using the TableView Class (v 1.32). The table contains columns of string data and columns of number data. Clicking on the header to sort doesn't sort numbers in correct order. The new sub in version 1.32 named SortTableNum sorts by number instead of string. Great and thank you!!! Because the table contains both string and number data I need to use different sort routines from the Tableview class when a user clicks on a column header. When a user click on a column of numbers I run SortTableNum() and when a user clicks on a column of strings I run SortTable()

I have read everything I can find on-line and in the Beginner's Guide but have not been able to figure out:

1. How to disable the sorting feature that automatically fires when a user clicks on a column header.
2. How to capture the Click event on a column header and find out what column was clicked so I can call the correct sort routine

This code initializes the table.
B4X:
    If InvTable.IsInitialized = False  Then
        InvTable.Initialize(Me,"InvTable",7,0,False)
        InvTable.AddToActivity(Activity,10,140,90%x,70%y)
        Dim Alignments() As Int
        Alignments=Array As Int(Gravity.LEFT,Gravity.LEFT,Gravity.LEFT,Gravity.LEFT,Gravity.RIGHT,Gravity.RIGHT,Gravity.RIGHT)
        InvTable.SetCellAlignments (Alignments)
           
    Else
        InvTable.ClearAll
    End If
    DoEvents
    InvTable.LoadTableFromCSV(File.DirRootExternal,DownloadFileName,True)
    InvTable.SetColumnsWidths(Array As Int(50dip,90dip,340dip,340dip,80dip,70dip,90%x -970))

Any help would be greatly appreciated.

Thanks,
Gary
 

GGS

Member
Licensed User
Longtime User
Hi,

Eeesh. Nevermind. Solved it quickly using HeaderClick event. I couldn't find any documentation for HeaderClick so I jut guessed and tried it. Nothing like making something harder than it is. Sorry!

Gary
 
Upvote 0
Top