B4J Tutorial SithasoDaisy TailwindCSS UI Toolkit: Q & A

Mashiane

Expert
Licensed User
Longtime User
My apologies, this was on my todo list for 1 but on 2. Please download the lib again. This is what had to be done. (a) on small devices, the modal should be full screen and when the size is set (b) use that size. It has been fixed.

Thanks for the heads up.
 

Mashiane

Expert
Licensed User
Longtime User
And in the rows, how I can set it by row ?
Add this code to your module

B4X:
'check a row, 0 based
Sub SetRowChecked(tblName As String, rowPos As Int, value As Boolean)
    Dim rowPos As Int = BANano.parseInt(rowPos) + 1
    If SDUIShared.Exists($"${tblName}_${rowPos}_selectall"$) = False Then Return
    BANano.GetElement($"#${tblName}_${rowPos}_selectall"$).SetChecked(value)
End Sub

Usage

B4X:
SetRowChecked(tbEmployees.id, 0, true)

Not tested...


PS: please note this only applies to visible rows, you cannot check/uncheck non-visible rows.
 

sdleidel

Active Member
Licensed User
Longtime User
There is an error.


// [5936] banano.GetElement( {79} ).SetChecked(value)
...u("#" + _tblname + "_" + _rowpos2 + "_selectall").nodes[0].checked=_value;


Uncaught (in promise) TypeError: Cannot set properties of undefined (setting 'checked')
at banano_webshop_pgshop.setrowchecked (app1693463235279.js:5068:67)
at banano_webshop_pgshop.mdlsduitablewarenkorbfilialenauswahl_selectrow (app1693463235279.js:5037:4)

How i can fix this ?
 

Mashiane

Expert
Licensed User
Longtime User
Is your code exactly like this?
B4X:
'check a row, 0 based
Sub SetRowChecked(tblName As String, rowPos As Int, value As Boolean)
    Dim rowPos As Int = BANano.parseInt(rowPos) + 1
    If SDUIShared.Exists($"${tblName}_${rowPos}_selectall"$) = False Then Return
    BANano.GetElement($"#${tblName}_${rowPos}_selectall"$).SetChecked(value)
End Sub

And you are passing it the table name and row on table with existing rows?

There should not be any word like tblname on the error response, check your code again please.
 

sdleidel

Active Member
Licensed User
Longtime User


1:
Sub SetRowChecked(tblName As String, rowPos As Int, value As Boolean)
    Dim rowPos2 As Int = banano.parseInt(rowPos) '+ 1

    If SDUIShared.Exists($"${tblName}_${rowPos2}_selectall"$) = False Then Return
    true")
    SDUIShared.SetChecked($"${tblName}_${rowPos2}_selectall.checkbox"$,value)
   
End Sub

This do what i want, but is this the right way ?
 

sdleidel

Active Member
Licensed User
Longtime User
No all is correct...
 

Mashiane

Expert
Licensed User
Longtime User
Adopted this code as...

B4X:
'check a row, 0 based
Sub SetRowSelectChecked(rowPos As Int, value As Boolean)
    Dim rowPos As Int = BANano.parseInt(rowPos) + 1
    If SDUIShared.Exists($"${mName}_${rowPos}_selectall"$) = False Then Return
    BANano.GetElement($"#${mName}_${rowPos}_selectall"$).SetChecked(value)
End Sub

And has been added as part of the table functionality.

Usage:

B4X:
'load items to the table and wait until that is done
BANano.Await(tb1.SetItems(Items))
'check the item at row 2
tb1.SetRowSelectChecked(1, True)

Output:



Thanks!
 

Mashiane

Expert
Licensed User
Longtime User
What is the difference ?
Returning the Size property only works with SetItemsPaginate. SetItemsPaginate calls SetItems internally only passing a portion of the paginated items in the list.

SetItems does not paginate the table, so if you have 1000 items, it will show all of them, whilst SetItemsPaginate splits your list into pages as per "records per page" propety.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…