B4J Question Tableview row selector

Magma

Expert
Licensed User
Longtime User
Does tableview have a row selector using B4J? How can I make it visible?
I have some time to work with it... because B4XTable is the best...

but if you want old outdated version of tableview... here you go:
B4X:
                    TableView1.SelectedRow=k   '(k an int number that represents the row - will select all the columns - there is also a single selection that you can toggle with:  .SingleCellSelection=True)
                    TableView1.ScrollTo(k)         'this will scroll the table at the row you want...
 
Upvote 0

abhimmit

New Member
Actually what I'm looking for is this, see image. The first column is the row selector, when clicked the table row is selected.

Tableview_with_Rowselector.png

Most tableviews/Datagrids out there have a standard row selector which you can enable/disable.
 
Upvote 0

Magma

Expert
Licensed User
Longtime User
@abhimmit ...so you don't want "specific" use "TableView Control"... you want a "checkbox" at the first row.... or the "TableView" with checkbox ?...

The "view" you are showing seems than can achieved better with CustomListView or B4XTable...
Is possible to do it with TableView Control... but not like this.
 
Upvote 0

Magma

Expert
Licensed User
Longtime User
...If you insist about "Tableview" Control... you can add checkbox with this way (when adding row(s) at your tableview)
Let' say you have 3 columns...

B4X:
Dim cb as checkbox 
cb.initialize("tblcheck") 
cb.checked = true 'If you wanna be checked or not...

Dim coldata(3) as object 
coldata(0) = cb   'your checkbox..
coldata(1) = "a second valueeeeeeee" 
coldata(2) = "a third valueeeee"

'add a row... (0-col will be the check box. 1-col text value, 2nd-col text value)
tableview.items.add(coldata)
 
Upvote 0

DarkoT

Active Member
Licensed User
Does tableview have a row selector using B4J? How can I make it visible?
Maybe this will help you - it's simple row marker which will help you to know which row is selected from user:
Example - Marker:
Private MarkLine As B4XTableSelections

' tableView = tblOpenWo (open workorders)
tblOpenWo.SelectionColor = xui.Color_Red
MarkLine.Initialize(tblOpenWo)
MarkLine.mode = MarkLine.MODE_SINGLE_LINE_PERMANENT

' when user click into tableview
Sub tblOpenWo_CellClicked (ColumnId As String, RowId As Long)
    Dim Item As Map = tblOpenWo.GetRow(RowId)
    ' mark line with red
    MarkLine.CellClicked(ColumnId, RowId)
End Sub
 
Upvote 0

Magma

Expert
Licensed User
Longtime User
Thanks all. I assume there nothing available at this time. I guess I will have to do it the hard way.
Sorry but... There are "all " availabe... are there but in any of these, the way of use changes...

So if want easy Inline editing at table: Your choice for "today" is B4XTable, Inline Editing add on, B4XTableSelections (selecting/mark a row)
But there also the old tableview (as i thought you needed)

In case you want just showing rows, columns and a choicebox at the first row, it is easy to add without using add-ons at b4xtable and tableview too, just adding at every row at the first column the object of choicebox or a toggle button, or b4xswitch...

[also have in mind addons are free] :)

and if all these not enough you can create from scratch your customlistview with any component you want !

You can do anything you want easily... that's B4X... but need to read a little for all these said... we are here in forum to help you, you can check tutorials and examples of all these !
 
Upvote 0

abhimmit

New Member
Thanks all, your response is very appreciated. I have almost managed to do what I want with tableview.
I will investigate other solution you mentioned at a later stage.
 
Upvote 0
Top