iOS Question delete row in csv table b4i

John Woodsmall

Active Member
Licensed User
Longtime User
no, I am using the
B4X:
Table4.LoadTableFromCSV(File.DirLibrary, "History.csv", False)

is there a function I can use?
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Add this code to the class:
B4X:
Public Sub RemoveRow(Row As Int)
  SV_ScrollChanged(SV.ScrollOffsetX, SV.ScrollOffsetY)
  Dim sr As Int = SelectedRow
  SelectRow(-1)
  Data.RemoveAt(Row)
  If Data.Size = 0 Then
  ClearAll
  Return
  End If
  For i = minVisibleRow To maxVisibleRow
  HideRow(i)
  Next
  maxVisibleRow = Min(maxVisibleRow, Data.Size - 1)
  minVisibleRow = Min(minVisibleRow, Data.Size - 1)
  For i = minVisibleRow To maxVisibleRow
  ShowRow(i)
  Next
  If sr = Row Then
  sr = -1
  Else If sr > Row Then
  sr = sr - 1
  End If
  SelectRow(sr)
  SV.Panel.Height = Data.Size * RowHeight
  SV_ScrollChanged(SV.ScrollOffsetX, Min(SV.ScrollOffsetY, SV.Panel.Height))
End Sub

Now you can remove any row you like from the table.
 
Upvote 0

John Woodsmall

Active Member
Licensed User
Longtime User
ok...thanks!
now how do i use it?
I guess i make a button on the page with the table and click it?
B4X:
Sub remove_row_click
    Dim rc As RowCol
    Dim rx = rc.Row
    Table4.RemoveRow(rx As Int)
End Sub

it does not let me do this?

1.) how do i get the row number?
2.) how do i make the remove_row_click event(above) work?
 
Upvote 0
Top