Android Question B4XTable Maximum Row not working

Scantech

Well-Known Member
Licensed User
I get 5 rows per page with MaximumRowsPerPage set to 20?

B4X:
Sub InitTableandSql
    Try

        Dim blnFileAvailable As Boolean

        'check external first
        If File.Exists(File.DirRootExternal, Starter.DiagReportDatabase & Starter.DBFile) Then
            If Starter.sql1.IsInitialized = False Then
                Starter.sql1.Initialize(File.DirRootExternal, Starter.DiagReportDatabase & Starter.DBFile, False)
            End If
            blnFileAvailable = True
        Else If File.Exists(File.DirInternal, Starter.DiagReportDatabase & Starter.DBFile) Then
            If Starter.sql1.IsInitialized = False Then
                Starter.sql1.Initialize(File.DirInternal, Starter.DiagReportDatabase & Starter.DBFile, False)
            End If
            blnFileAvailable = True
        Else
            blnFileAvailable = False
        End If
            
        Activity.LoadLayout("diagreporttable")

        'this is for edit and delete button
        editCol = B4XTable1.AddColumn("Edit", B4XTable1.COLUMN_TYPE_TEXT)
        editCol.Sortable = False
        editCol.Width = 218dip
        
        B4XTable1.RowHeight = 80dip
'        B4XTable1.NumberOfFrozenColumns = 1
    
        B4XTable1.AddColumn("ID", B4XTable1.COLUMN_TYPE_NUMBERS)
        B4XTable1.AddColumn("RO", B4XTable1.COLUMN_TYPE_TEXT)
        B4XTable1.AddColumn("Date", B4XTable1.COLUMN_TYPE_TEXT)
        B4XTable1.AddColumn("First", B4XTable1.COLUMN_TYPE_TEXT)
        B4XTable1.AddColumn("Last", B4XTable1.COLUMN_TYPE_TEXT)
        B4XTable1.AddColumn("VIN", B4XTable1.COLUMN_TYPE_TEXT).Width = 170dip
        B4XTable1.AddColumn("Year", B4XTable1.COLUMN_TYPE_TEXT)
        B4XTable1.AddColumn("Make", B4XTable1.COLUMN_TYPE_TEXT)
        B4XTable1.AddColumn("Model", B4XTable1.COLUMN_TYPE_TEXT)
        B4XTable1.AddColumn("File Name", B4XTable1.COLUMN_TYPE_TEXT).Width = 170dip
    
        B4XTable1.MaximumRowsPerPage = 20
        
        Dim Data As List
        Data.Initialize
        
        If blnFileAvailable = True Then
            Dim rs As ResultSet = Starter.sql1.ExecQuery("SELECT ID, RO, Date, FirstName, LastName, VIN, Year, Make, Model, FileName FROM diagnosticlog")
            Dim startTime As Long = DateTime.Now
            
            Do While rs.NextRow
                Dim row(11) As Object
                row(1) = rs.GetDouble("ID")
                row(2) = rs.GetString("RO")
                row(3) = rs.GetString("Date")
                row(4) = rs.GetString("FirstName")
                row(5) = rs.GetString("LastName")
                row(6) = rs.GetString("VIN")
                row(7) = rs.GetString("Year")
                row(8) = rs.GetString("Make")
                row(9) = rs.GetString("Model")
                row(10) = rs.GetString("FileName")
    
                row(0) = ""
                If row(1) = Null Then row(1) = ""
                If row(2) = Null Then row(2) = ""
                If row(3) = Null Then row(3) = ""
                If row(4) = Null Then row(4) = ""
                If row(5) = Null Then row(5) = ""
                If row(6) = Null Then row(6) = ""
                If row(7) = Null Then row(7) = ""
                If row(8) = Null Then row(8) = ""
                If row(9) = Null Then row(9) = ""
                If row(10) = Null Then row(10) = ""
                
                Data.Add(row)
                
            Loop
            Log("Index time: " & (DateTime.Now - startTime) & " ms")

            rs.Close

            Dim startTime As Long = DateTime.Now

            B4XTable1.SetData(Data)
            Log("Index time: " & (DateTime.Now - startTime) & " ms")
        
            B4XTable1.BuildLayoutsCache(B4XTable1.MaximumRowsPerPage)
    
            For i = 1 To editCol.CellsLayouts.Size - 1
                Dim p As B4XView = editCol.CellsLayouts.Get(i)
'                p.AddView(CreateButton("btnEdit", Chr(0xF044)), 2dip, 5dip, 70dip, 70dip)
                p.AddView(CreateButton("btnDelete", Chr(0xF00D)), 2dip, 5dip, 70dip, 70dip)
                p.AddView(CreateButton("btnView",Chr(0xF15C)), 74dip, 5dip, 70dip, 70dip)
                p.AddView(CreateButton("btnPrint",Chr(0xF02F)), 146dip, 5dip, 70dip, 70dip)
            Next
            
        Else
            'no file..do nothing but show the table
            B4XTable1.SetData(Data)
        End If
                
    Catch
        Log("Error InitTable and Sql" & LastException.Message)
    End Try
End Sub
 
Top