B4A Library [Class] TableView - Supports tables of any size

An improved version of this class is available here: http://www.basic4ppc.com/forum/addi...icial-updates/30649-class-flexible-table.html


The Table class allows you to show tables of any sizes. The views (labels) are reused to avoid creating many views.

With the help of StringUtils the table can be loaded and saved to a CSV file. It shouldn't be difficult to show SQL tables using DBUtils.ExecuteMemoryTable.

SS-2012-07-04_10.38.01.png


Follow the attached example to see how the class is used. To add it to your own project you need to add the class module to your project and add a reference to StringUtils library.

RemoveRow code is available here: http://www.basic4ppc.com/forum/showpost.php?p=146795&postcount=147

V1.10 uploaded. New method: SetColumnsWidths. Allows you to manually set the width of each column
V1.11 uploaded. Fixes a bug with grey stripes appearing.
 

Attachments

  • Table.zip
    14.9 KB · Views: 6,618
Last edited:

Lyndon Bermoy

Active Member
Licensed User
Hello good day! I tried so many codes on the table_cellclick but I cannot get the correct code on showing or selecting the rows of the table on the database because it always shows the last field/record of the database.

Here's my code:

B4X:
Sub Table1_CellClick (Col As Int, Row As Int)


   Main.cursor1 = Main.sql1.ExecQuery("SELECT * FROM tblStudent")
For i = 0 To Main.cursor1.RowCount - 1
Main.cursor1.Position = 0
       Grading.last =Main.cursor1.GetString("lname")
   Grading.first =  Main.cursor1.GetString("fname")
   Grading.sub1 =  subj
   Grading.sec1 =  sec
   Grading.attendance1 = Main.cursor1.GetString("attendance")
   Grading.per = rb
   Grading.quiztot =  Main.cursor1.GetString("quizTotal")
   Grading.assTot =  Main.cursor1.GetString("assTotal")
   Grading.project =  Main.cursor1.GetString("project")
   Grading.exam =  Main.cursor1.GetString("exam")
   Grading.grade=  Main.cursor1.GetString("grade")
     StartActivity("grading")
   
     Next
End Sub

My code above shows only the last record of my database. All I wanted is that if I select the row, it will show the correct selected field to my next display but it ended up showing the last record of my database. Thanks
 

Pantelis Loizou

Member
Licensed User
Hallo everyone! Need some help...Is there any way in the existing library where i can use the functionality of multiple row selection? E.g. Deletion of muliple rows instead of choosing one by one! Any info would be greatly appreciated. Thanx!
 

klaus

Expert
Licensed User
Is there any way in the existing library where i can use the functionality of multiple row selection?
Be aware that this is not a library but a Class.
The class in this thread is an 'old' one.
You find the more recent one in the Flexible Table thread, which has a multi select mode..
 

advansis

Active Member
Licensed User
I didn't find any function to set a single column text, I simply wrote it. If you like, please add it to your shared code:

B4X:
public Sub SetHeaderName (Col As Int, Text As String)
    Dim L As Label=Header.GetView(Col)
    L.Text=Text
End Sub
 
Top