B4J Tutorial SithasoDaisy TailwindCSS UI Toolkit: Q & A

Hi there

NB: Where possible, please include a simple project that demonstrates your use case.

Do you have any questions about SithasoDaisy UI Toolkit?

You can shoot it here and we will oblige.

Thanks in advance?


Join on Telegram


Check $5 WebApps

 
Last edited:

giannimaione

Well-Known Member
Licensed User
Longtime User
it's a bug or my mistake;
a SDUITable1 with column:
B4X:
'
'
AddColumnNumber("qta", "Quantità", False)
AddColumnNumber("listino", "Prezzo", False)
AddColumn("nome", "Articolo")
AddDesignerColums
'
'
'and
'Lrigo as List
'populate/fill Lrigo
'
SetItemsPaginate(Lrigo)
without adding event SDUITable1_Change (Value As Object, Column As String, item As Map)
B4X:
Dim newList as List = SDUITable1.Rows
'qta and listino are blank
For i=0 To newList.Size-1
        Dim mapInfo As Map = newList.Get(i)
        For Each Key As String In mapInfo.Keys
            Dim Value As Object = mapInfo.Get(Key)
            Log(Key & "=" & Value) 'no value "qta" and "listino"
        Next
        Log(" ")
    Next
but if I add the event
B4X:
SDUITable1_Change (Value As Object, Column As String, item As Map)
'Do Nothing
End Sub
'good
B4X:
Dim newList as List = SDUITable1.Rows
'qta and listino are OK!
For i=0 To newList.Size-1
        Dim mapInfo As Map = newList.Get(i)
        For Each Key As String In mapInfo.Keys
            Dim Value As Object = mapInfo.Get(Key)
            Log(Key & "=" & Value) 'there is a value
        Next
        Log(" ")
    Next
where am I wrong?
 

Mashiane

Expert
Licensed User
Longtime User
it's a bug or my mistake;
a SDUITable1 with column:
B4X:
'
'
AddColumnNumber("qta", "Quantità", False)
AddColumnNumber("listino", "Prezzo", False)
AddColumn("nome", "Articolo")
AddDesignerColums
'
'
'and
'Lrigo as List
'populate/fill Lrigo
'
SetItemsPaginate(Lrigo)
without adding event SDUITable1_Change (Value As Object, Column As String, item As Map)
B4X:
Dim newList as List = SDUITable1.Rows
'qta and listino are blank
For i=0 To newList.Size-1
        Dim mapInfo As Map = newList.Get(i)
        For Each Key As String In mapInfo.Keys
            Dim Value As Object = mapInfo.Get(Key)
            Log(Key & "=" & Value) 'no value "qta" and "listino"
        Next
        Log(" ")
    Next
but if I add the event
B4X:
SDUITable1_Change (Value As Object, Column As String, item As Map)
'Do Nothing
End Sub
'good
B4X:
Dim newList as List = SDUITable1.Rows
'qta and listino are OK!
For i=0 To newList.Size-1
        Dim mapInfo As Map = newList.Get(i)
        For Each Key As String In mapInfo.Keys
            Dim Value As Object = mapInfo.Get(Key)
            Log(Key & "=" & Value) 'there is a value
        Next
        Log(" ")
    Next
where am I wrong?
Without a small example project, its very difficult to understand what the issue is as I dont have any clue of what you want to achieve.

In the meantime, let me explain what happens when one called SetItemsPerPage.

1. SetItemsPaginate works with ItemsPerPage. This means that if you have 100 records in your list, and your ItemsPerPage is 10, what will be shown in your table is 10 items ONLY and not the 100, however, internally your list of records passed to SetItemsPerPage is stored on a list variable called Originals. If you want to access everything you added to the table, use the Originals public list variable and NOT Rows.

2. SetItemsPaginate calls SetItems internally with the 10 items from ItemsPerPage and will do this when clicking Next/Previous in your table. Each time you click Prev/Next, the 10 records being paginated are stored in a list variable called Rows.

3. Now, if you want for all the 100 records to show in your table WITHOUT PAGINATION, you can call SetItems(?) and not SetItemsPaginate, both Originals & Rows will have the same content in this case.

A change event on a table is only activated when your table has inline editing and will affect only the record being edited.

With this clarity of the internal workins, what are you trying to achieve and how can I help?
 

giannimaione

Well-Known Member
Licensed User
Longtime User
Without a small example project,
sorry;
SDUITable.PNG

1) sduitable is fill (first time) with ONLY "Prezzo" (Price) and "Articolo" (Item)", QTY is empty;
2) now user edit "Quantita" and can modify "Prezzo"
3) sduitable: no add new record; no pagination; no delete; no refresh;

how to read ALL data from SDUITABLE ?
SDUITable.Rows or SDUITable.Originals they do not contain value of "quantita" and value of modify "prezzo";

but if insert this sub
B4X:
Private Sub SDUITable_Change (Value As Object, Column As String, item As Map)
'do nothing
End Sub
then, SDUITable.Rows or SDUITable.Originals they have all the information
 

Mashiane

Expert
Licensed User
Longtime User
sorry;
View attachment 155334
1) sduitable is fill (first time) with ONLY "Prezzo" (Price) and "Articolo" (Item)", QTY is empty;
2) now user edit "Quantita" and can modify "Prezzo"
3) sduitable: no add new record; no pagination; no delete; no refresh;

how to read ALL data from SDUITABLE ?
SDUITable.Rows or SDUITable.Originals they do not contain value of "quantita" and value of modify "prezzo";

but if insert this sub
B4X:
Private Sub SDUITable_Change (Value As Object, Column As String, item As Map)
'do nothing
End Sub
then, SDUITable.Rows or SDUITable.Originals they have all the information
Because you have inline editing, you NEED to have a change or changerow event, so that the changes you made in the row can be trapped There is no way around it, it's by design.
 

giannimaione

Well-Known Member
Licensed User
Longtime User
Is there a way to perform date entry without using "flat pick date ", but with validity checking?
 

Mashiane

Expert
Licensed User
Longtime User
Is there a way to perform date entry without using "flat pick date ", but with validity checking?
You can use a normal textbox and perhaps add a placeholder of YYYY-MM-DD or whatever you prefer. You can also use 2 SDUISelects, one with dates from 1-31 and one with months Jan - Dec and have SDUITextBox for years. You can use a single row and 3 columns for that to put the components.

You will have to add your own validation still.
 

giannimaione

Well-Known Member
Licensed User
Longtime User
my great memory bug
SDUITable;
SDUITable.AddColumnNumber ("amout", ......)

B4X:
Private Sub SDUIButton1_Click (e As BANanoEvent)
'here CalculateALL 
'some instructions
'newValue = Value1 * Value2
'now, how to set for each rows of SDUITable a value of Column "amount" ?
'example: ---> SDUITable .... setValues (rowNumber, "amount", newValue)
 

giannimaione

Well-Known Member
Licensed User
Longtime User
B4X:
Private tbRigo As SDUITable
'
'
tbRigo.AddColumnNumber("qta", "Quantità", False)
tbRigo.SetColumnAlign("qta", "right")
tbRigo.SetColumnWidth("qta", "10rem")
    '
tbRigo.AddColumnNumber("listino", "Prezzo", False)
tbRigo.SetColumnAlign("listino", "right")
tbRigo.SetColumnWidth("listino", "10rem")
    '
tbRigo.AddColumn("importo", "Importo")
tbRigo.SetColumnAlign("importo", "right")
tbRigo.SetColumnWidth("importo", "10rem")
    '
tbRigo.AddColumn("nome", "Articolo")
    '
tbRigo.AddDesignerColums

'ok
'now i fill myList, from sql DB
Dim myList as List
'select from dbTable
Do While result.NextRow
myList.Add(CreateMap(... ...., "qta":"", "listino":"", "importo":"0", ...)
Loop
'
'
'and fill tbRigo
banano.Await(tbRigo.SetItemsPaginate(myList))
'here, it's ok
'
'

now user edit "Quantita" and "Prezzo"
and into sub

B4X:
Private Sub SDUIButton1_Click (e As BANanoEvent)
'here CalculateALL 
'now i calculate for each row of tbRigo 
'multiply qta by listino:
'ask: how to fill Column "importo" of each rows?
End Sub
 

Mashiane

Expert
Licensed User
Longtime User
Please provide me simple project that is reproducing the problem.
I was expecting a simple b4j sithasodaisy project that reproduces your question so that I can edit that and help you solve your question.

Please send a zip file of a simple reproduction of the matter. Thanks.

Anyway, check this example.

PS: Please next time, create a b4j project to make it easier to help.

 
Last edited:

giannimaione

Well-Known Member
Licensed User
Longtime User
I have a list or a table, for example
Anna
Tony
Bob
Zed
Lisa
Can I move an element up or down with the mouse?
drag and drop ?

the result must be
Zed
Bob
Lisa
Anna
Tony
 

sdleidel

Active Member
Licensed User
Longtime User
Short question.
Was anything changed in the "drawer" in the last update?_
If I set the drawer with "drawer.NonMobile", the browser on the PC shows the "mobile version" of the drawer...
 

Mashiane

Expert
Licensed User
Longtime User
Short question.
Was anything changed in the "drawer" in the last update?_
If I set the drawer with "drawer.NonMobile", the browser on the PC shows the "mobile version" of the drawer...
Not that I can recall. Which version are you using?

How is your drawer created? By code or by using the abstract designer?

if you are using the abstract designer, please ensure that the "Mobile" option is set at false. This is the default behavior though.

If its created with AddAppDrawer, then mobile is set on by default, meaning that the drawer will always be open on PC.

if created with AddAppDrawer1 / AddAppDrawer2 then the 3rd variable on the signature should be false.
 

giannimaione

Well-Known Member
Licensed User
Longtime User
how to set ToolTip?
i add a icon with
B4X:
SDUITable.AddToolbarButtonIcon("ricalcola", "fa-solid fa-euro-sign", app.COLOR_INFO)
'
'
'
Private Sub tbRigo_ricalcola (e As BANanoEvent)
'here is OK
End Sub
can i add a ToolTip on Button Icon ?
 

Mashiane

Expert
Licensed User
Longtime User
how to set ToolTip?
i add a icon with
B4X:
SDUITable.AddToolbarButtonIcon("ricalcola", "fa-solid fa-euro-sign", app.COLOR_INFO)
'
'
'
Private Sub tbRigo_ricalcola (e As BANanoEvent)
'here is OK
End Sub
can i add a ToolTip on Button Icon ?
Yep, here is an example

B4X:
tblclientdashboard.SetToolbarButtonToolTip("deleteall", "To delete all Client Dashboards on the current page, click this button.", app.COLOR_PRIMARY, "left", True)

A similar example is also available on the SD Demo App.

All the best.
 

giannimaione

Well-Known Member
Licensed User
Longtime User
a solution with whatsapp ?

a simple code to send a message
B4X:
https://wa.me/0039358........?text=hello
'or
whatsapp://send?phone=0039358.....&text=hellp

how to integrate it with BANano / SithasoDaisy ?
 

Mashiane

Expert
Licensed User
Longtime User
a solution with whatsapp ?

a simple code to send a message
B4X:
https://wa.me/0039358........?text=hello
'or
whatsapp://send?phone=0039358.....&text=hellp

how to integrate it with BANano / SithasoDaisy ?
Some various options.

1. Open a URL in a new tab in the browser

B4X:
'open a url on a blank window
Sub OpenURLTab(url As String)
    Dim bo As BANanoObject = BANano.Window.RunMethod("open", Array(url, "_blank"))
    bo.RunMethod("focus", Null)
End Sub

2. Open whatsapp to send a message

B4X:
'open whatsapp using the telephone number
'include country code with + on number
Sub OpenURLWhatsApp(tel As String)
    OpenURLTab($"https://api.whatsapp.com/send?phone=${tel}"$)
End Sub

3. Open whatsapps with a number and text

B4X:
Sub OpenURLWhatsAppText(tel As String, text As String)
    OpenURLTab($"https://api.whatsapp.com/send?phone=${tel}&text=${text}"$)
End Sub

4. Make a phone call

B4X:
'place a call using a number
'include country code with + on number
Sub OpenURLTel(tel As String)
    OpenURLTab($"tel:${tel}"$)
End Sub

Hope it helps...

PS: These are built in into the SDUIShared.? code module included with SithasoDaisy.
 

sdleidel

Active Member
Licensed User
Longtime User
Hi,
in a Table i have add the DatePicker1
1:
SDUITableEdit.AddColumnDatePicker1("myenddatum","Bis", False, "d-m-Y", "d-m-Y", False, False, False,"de")

So, after i use "setitems" the Datefield is clear. That is ok, i have not Date set.

How i can change or better, how i can update the Date (Field) with code?

The Field is blank...
 
Top