B4J Question Edit B4XTable cell

Radisk3

Member
Licensed User
Hello!

Is there any way to edit directly in the b4xtable cell?

I refer to the link example:

At the moment I use TableView with EditText but it gets heavy with many lines.
There are files with more than 20000 lines to load and this makes the application extremely heavy when made in TableView with EditText.
Anyway, I'm trying to find a way to replace my C# - made apps with those made in B4J.
 

mangojack

Well-Known Member
Licensed User
Longtime User
Is there any way to edit directly in the b4xtable cell?

Yes .. https://www.b4x.com/android/forum/threads/b4xtable-update-a-single-cell.105365/post-660034


Edit : revisiting that link , the answer I gave was slightly incomplete , so ...
B4X:
    SetValue (B4XTable1, "Name", 3, "ABC123") 'Table, Column, Row, Value

    Sub SetValue (tbl As B4XTable, columnID As String,  RowId As Long, Value As String) 'Value=String  as Column declared as TEXT.
        Dim column As B4XTableColumn = tbl.GetColumn(columnID)
        tbl.sql1.ExecNonQuery2($"UPDATE data SET ${column.SQLID}  = ? WHERE rowid = ?"$, Array As String(Value, RowId))
        tbl.Refresh
    End Sub
 
Last edited:
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
I think it is not exactly what @Radisk3 is searching for:
to edit directly in the b4xtable cell?

An alternative could be:
https://www.b4x.com/android/forum/threads/b4x-xui-sd-flexgrid-table.100897/#post-633880
which I don't know and therefore I don't know the quality of it, I just looked at the animated gifs.


EDIT: Forget this post :(, that library is only for B4A and B4i.
(I could remove this post but it could be useful to encourage the author of that library to create the B4J version 🙂)
 
Last edited:
Upvote 0

mangojack

Well-Known Member
Licensed User
Longtime User
I think it is not exactly what @Radisk3 is searching for:

Re reading his question, you might be correct.



If that is the case, possible this might help .. Editable B4X Table

It is a B4A tutorial , but I am sure it can be adapted to B4J ...

also if saving the table to CSV file does not suit , that also can be changed to save to SQL db for example.
 
Upvote 0

mangojack

Well-Known Member
Licensed User
Longtime User
Still not directly (B4X Table shows labels, if I'm not wrong)

Correct ... I'm just not understanding your point. Does he want to telepath or Jedi mind trick the change to the table ? :rolleyes:

Anyway I'll leave this for @Radisk3 to advise if the above suggestions are of any use to him.
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
I'm just not understanding your point. Does he want to telepath or Jedi mind trick the change to the table ?
I think he wants to be able to edit a cell directly, as you can do in Excel, for example, instead of show a dialog to do it.

Also, I think (I think too much and do little 😂) that is possible to change that "way" (show a dialog) using a little trick: creating a transparent full screen panel, getting the cell screen coordinates, adding an EditText at the same position... in short, overlaying the label-cell with an EditText (only to edit the content, of course).
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
 
Upvote 0

Radisk3

Member
Licensed User
Correct ... I'm just not understanding your point. Does he want to telepath or Jedi mind trick the change to the table ? :rolleyes:

Anyway I'll leave this for @Radisk3 to advise if the above suggestions are of any use to him.

Hey, mangojack!
Thanks for the quick answer.
In the first link that passed, I already knew the solution, but I need to edit in the cell itself and not through an editable box.
It is excellent for Android and iOS, but for B4J it loses agility.
Following the discussion, in the end, Erel passed the solution that it should resolve.
I've set an example and I'll work on it.
 
Upvote 0

Radisk3

Member
Licensed User
I think he wants to be able to edit a cell directly, as you can do in Excel, for example, instead of show a dialog to do it.

Also, I think (I think too much and do little 😂) that is possible to change that "way" (show a dialog) using a little trick: creating a transparent full screen panel, getting the cell screen coordinates, adding an EditText at the same position... in short, overlaying the label-cell with an EditText (only to edit the content, of course).

Hello LucaMs!
Thanks for the feedback.
I didn't know SD FlexGrid. Although it is for B4A and B4i, I will find out if it is adaptable to B4J or if I can replicate in a project I have in B4A/i. very useful.
Finally, I even tried to do like you mentioned creating a box with cell coordinates ... an engineering that saw no end and gave up thinking it was better to ask at the forum hehehe.
But I think Erel posted a solution that I'll see if I can do everything in it.
Again, thanks for your help.
 
Upvote 0

Radisk3

Member
Licensed User
Thank you Erel.
I tested here and it will help a lot in my projects.
 
Upvote 0
Top