B4A Library [Class] Flexible Table

Tom1s

Member
Licensed User
Longtime User
It says not initialized because it cannot find anything. It works OK before delete.

How can I select a row then?
m=DBUtils.Executemap(SQL1,"Select * FROM LoadedT WHERE ROWid = "&Row2, Null)

Yes but I need to have a local copy because I copy the rows from the server and then delete those.
 

LucaMs

Expert
Licensed User
Longtime User
Contains your Table (the view) the column "ROWid"?

If so, you should get its value using something like:

RowIDToDelete = Table1.GetValue(0 , Row) <--- 0 if ROWid column position is 0, as I think

and then:

m=DBUtils.Executemap(SQL1,"Select * FROM LoadedT WHERE ROWid = " & RowIDToDelete, Null)
 

klaus

Expert
Licensed User
Longtime User
It says not initialized because it cannot find anything.
You are right.

In my programs I have an ID INTERGER PRIMARY KEY column and I read the IDs in a List.
This works also with ROWIDs.
Then I get the SCL row id with SQLRowId = RowIDList.Get(TableRow).
I use it also in the SCLiteLight2 and SCLiteLight3 examples in the User's Guide.
SCLiteLight2 and SCLiteLight3 don't use the Table Class nor DBUtils, but the principle remains.
 

Tom1s

Member
Licensed User
Longtime User
Thanks I got it working!
Well what is the right way to update the table if I delete the row from the database?

If I call FillTableLT the header blinks and there are two numbers on top of each other at the bottom of the screen.(X Rows)
 

Tom1s

Member
Licensed User
Longtime User
That works. What if I update the database and then update the table. Perhaps I need to update the whole page with panel? Because if I call two times FILLTABLE table.removerow does not work anymore.

B4X:
pContent.RemoveAllViews
pContent.LoadLayout("page1")
FillTableLT
 

Tom1s

Member
Licensed User
Longtime User
Ok. I try to explain. Pagemain contains (actionbar and pcontent panel).Page1 contains panel1.
Now I realize why I don't use the same panel but this is how i got it working.
I have three tables and three pages and slidingmenu where those are switched.

Now when I update the database say two more rows. The only working solution that I have found is to update the table with:
pContent.RemoveAllViews
pContent.LoadLayout("page1")
FillTableLT




B4X:
Sub clv1_ItemClick(Index As Int, Value As Object)
  

Select Index
Case "0"
sm.HideMenus
pContent.RemoveAllViews
pContent.LoadLayout("page1")
FillTableLT

B4X:
Sub FillTableLT
'    Table1.ClearAll
    Table1.Initialize(Me, "Table1", 4, Gravity.CENTER_HORIZONTAL, True)
    Table1.CellAlignment = Bit.OR(Gravity.center, Gravity.CENTER_VERTICAL)
    Table1.HeaderColor = Colors.BLACK
    Table1.HeaderTextColor = Colors.White
    Table1.TextColor = Colors.white
    Table1.TableColor = Colors.Gray
    Table1.RowHeight = 50dip
    Table1.RowColor1 = Colors.Gray
    Table1.RowColor2 = Colors.LightGray
    Table1.SelectedCellColor = Colors.blue
    Table1.SelectedRowColor = Colors.Blue
'    Table1.AllowSelection = True
    Table1.AddToActivity(panel1, 0, 0, panel1.Width, panel1.Height)
'    Table1.MultiSelect = True
    Table1.MultiSelect = False
    Table1.SortColumn = False
    Table1.SingleLine = False  
'    Table1.SetAutomaticWidths
    Dim Query As String
'    Table1.ClearAll


    Table1.LineWidth = 2dip
    Table1.TextSize = 18

  

    Query = "SELECT * FROM " & "LoadedT"

  
    Table1.LoadSQLiteDB(SQL1, Query, True)
  
    Table1.SetColumnsWidths(Array As Int(10%x,20%x, 30%x, 40%x))

End Sub
 

vecino

Well-Known Member
Licensed User
Longtime User
Hello, is it possible to display an image in a column in a table?
 

luciano deri

Active Member
Licensed User
Longtime User
Hello everybody I have a problem in table display on a activity inside a horizontal scrollview. The table not scroll e not do click event.
Some tips to solve?
 

luciano deri

Active Member
Licensed User
Longtime User
I tinked.. I use HorizontalScrollView to show a lot of activity, in one of this i display a table for datail of a master record. Could I have same problem using a ScrollView to do by hand the table on activity detail?
 

klaus

Expert
Licensed User
Longtime User
The question is, what do you want to scroll when you move the finger on the screen ?
The ScrollView or the Table ?
When you move the finger on the screen the ScrollView captures the Touch event and consumes it.
You could try to add the ScrollView_Touch event with the Reflection library and handle everything yourself.
I haven't tried something like that and I'm not sure if it will work correctly.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…