B4J Question [SOLVED][ABMATERIAL] ABMTable column sort is not working for 4.51 Library

Ganiadi

Active Member
Licensed User
Longtime User
Dear ABMaterial expert,

I use ABMTable and ABMATERIAL ver. 4.30 to create and populate some records. and it works nicely when i click column to sort, either ASC or DESC.
But today when i upgraded to 4.51, the sort order doesnt work anymore.
Please Help

B4X:
public Sub ConnectPage()
    ABMShared.BuildPageHeader(page,"Acoount")

    '============================SEARCHING SECTION================================
    Dim searchEntry As ABMInput
    searchEntry.Initialize(page, "searchEntry", ABM.INPUT_TEXT, "Profit Centre", False, "lightblue")
    searchEntry.RaiseChangedEvent = True
    searchEntry.RaiseFocusEvent = True
    page.CellR(0,2).AddComponent(searchEntry)   
    
    Dim btnSearch As ABMButton
    btnSearch.InitializeFloating(page, "btnSearch", "mdi-action-search", "")
    page.CellR(0,3).AddComponent(btnSearch)
    '============================PAGINATION SECTION==============================
    
    Dim pagination As ABMPagination
    pagination.Initialize(page, "pagination", 5, True, True, "")
    pagination.SetTotalNumberOfPages(0)
    page.Cell(1,1).AddComponent(pagination)

    '=============================TABLE SECTION===============================
    Dim tbFolder As ABMTable
    tbFolder.Initialize(page, "tbFolder",  True,  True, True, "tbltheme")
    tbFolder.SetHeaders( Array As String ("key", "Description", "Tax", "Service" ,"Formula", "Detail"))
    tbFolder.SetHeaderThemes(    Array As String ("bgc", "bgl", "bgr", "bgr", "bgc", "bgc"   ))
    tbFolder.SetColumnVisible(   Array As Boolean(False, True, True, True, True, True  ))
    tbFolder.SetColumnDataFields(Array As String ("key", "col1", "col2", "col3" ,"col4", "col5"))
        
    tbFolder.IsResponsive = True
    tbFolder.IsBordered = True
    tbFolder.SetFooter("Total Records: 0", 12,"bg")
    
    page.Cell(2,1).AddComponent(tbFolder)
    
    '=============================ADD BUTTON==================================
    Dim AddRecord As ABMActionButton
    AddRecord.Initialize(page, "AddRecord", "mdi-content-add", "bigblue","")
    AddRecord.MainButton.Size = ABM.BUTTONSIZE_LARGE
    page.AddActionButton(AddRecord)
    
    '=============================LOAD TABLE==================================
    LoadTable(1)
    '=========================================================================
    ' refresh the page
    page.Refresh
    
    ' Tell the browser we finished loading
    page.FinishedLoading
    ' restoring the navigation bar position
    page.RestoreNavigationBarPosition

End Sub

Sub tbFolder_SortChanged(DataField As String, Order As String)
  
'    Dim tbFolder As ABMTable = page.Component("tbFolder")
    Log("  datafield  clicked: "&DataField)
    Log(Order)
    ' do what you want with this...
    If DataField = "col1" Then
        cColumnOrder = " Order by description " & Order & " "
    End If
    If DataField = "col2" Then
        cColumnOrder = " Order by tax " & Order & " "
    End If
    If DataField = "col3" Then
        cColumnOrder = " Order by service " & Order & " "
    End If
    
    LoadTable(1)
    
  
End Sub
 

Harris

Expert
Licensed User
Longtime User
Sorry, I don't use sort currently but did experiment early on - and it worked doing as u described...
 
Upvote 0

Ganiadi

Active Member
Licensed User
Longtime User
Sorry, I don't use sort currently but did experiment early on - and it worked doing as u described...
Hi Harris, can you pls let me know how you do that, since i can not get the sorted column in the second time. My scenario is, i click a column, it will sorted in ascending, but when i click again for the same column for Descending order it does not work.

Tks
 
Upvote 0

Ganiadi

Active Member
Licensed User
Longtime User
Log(Order)

What does this log item say - ASC or DESC?
The log(order) DESC, where i also tried to display the list log from LoadTable(1) and the values result were corrects both ASC and DESC. It seems the table display were not refresh.
I tried to put refresh still not working.
But when i changed to 4.30 it worked perfect.
Tks
 
Upvote 0

Ganiadi

Active Member
Licensed User
Longtime User
Sorry for the delay, but this seems to be tougher that first expected. Can you try this .js file (take a backup for the old one and overwrite in /www/js/ )

Note: you may have to press CTRL+F5 in the browser to refresh it.

Alwaysbusy
Hi Allain,

Both version sorttable.4.32.min old and new one are working nicely now after pressing CTRL-F5

Tks & appreciate for your help Allain ?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…