B4J Question How do you get the data held in a webview table cell [SOLVED]

Colin Evans

Active Member
Licensed User
Longtime User
Hi, I must be missing something but cannot figure out how to get the data held in a specific cell of a table contained in a webview

B4X:
Private Sub wbvTable_LocationChanged (Location As String)
    If Location.Contains("stub") Then
        Private values() As String
        values = Regex.Split("[.]", Location.SubString(7))
        SelectedCol = values(0)
        SelectedRow = values(1)

    End If
End Sub

I can get the co-ordinates the selected column and selected row but how do I use these to get the data selected when clicked on to use elsewhere in the program,

i.e if the data held in row 1 column 0 is a code that when the user clicks on that cell I can use the code elsewhere, hope that makes sense, help
 

Colin Evans

Active Member
Licensed User
Longtime User
Thanks, Erel, I realise there are better ways, I was just playing with one of the SQLite examples I believe Klaus did some time ago but because I've amended the webview to display data based on a date selected from datepicker the RowIDList doesn't seem to work so I want to select the ID held in the first column of the row selected but I can't figure how to get this data.

If it can't be done I'll start again, thanks again
 
Upvote 0

Colin Evans

Active Member
Licensed User
Longtime User
Switched my code to use a tableview instead of webview and I can get the row id when I change the cell location with a click but how do i get the information held in a specific cell when clicked, also how do I get the cell data held in the first cell, 0,0 when the table is first read into the tableview via dbutils.

I've searched the forum but can't seem to find anything that helps (given my limitations :) )
 
Upvote 0

Colin Evans

Active Member
Licensed User
Longtime User
I've used the Tableview and tried Webview from within the designer

Don't quite know how I've solved it but it's working, I think I was trying to get the data using the data held in the 0,0 cell, lblID.text, when it was only set to True and not the data. once I created a TableView1_SelectedRowChanged(index as Int, Row() as object it worked

B4X:
Sub TableView1_SelectedRowChanged(Index As Int, Row() As Object)
    If Index = -1 Then Return
    lblID.Text = Row(0) 'id is the first column
    Log("Index " & Index & " Row(0) " & Row(0) & " ID is " & lblID.Text)
    UpdateSelectedEntry
End Sub
 
Last edited:
Upvote 0
Top