B4J Question (solved)【abmaterial】modalsheet doesn't update

liulifeng77

Active Member
Licensed User
Longtime User
when I click a button, page will show a modalsheet which connects with sql database. if data changed, modalsheet always show the same data. why?


Sub btn_question_clicked(Target As String)

page.AddModalSheetTemplate(BuildchooseSheet)
page.Refresh

page.ShowModalSheet("messagemodal")


End Sub

regards
 

mindful

Active Member
Licensed User
This is how i do it - just an example:

1. Add the page.AddModalSheetTemplate(BuildChooseSheet) in the ConnectPage method or BuildPage

2. Create a sub ShowChooseSheet():
B4X:
Public Sub ShowChooseSheet()
    'cast the controls that you need to modify
    Dim YourModalSheet As ABMModalSheet = Page.ModalSheet("yourmodalsheet")
    Dim YourLabelFromModalSheet As ABMLabel = YourModalSheet.Content.Component("yourlabel")
    Dim YourOtherLabelFromModalSheet As ABMLabel = YourModalSheet.Content.Component("yourotherlabel")
    'after you casted the needed controls that you need to modify set their new values
    YourLabelFromModalSheet.Text = "modification 1"
    YourOtherLabelFromModalSheet.Text = "modification 2"
    'refresh modalsheet content or you could refresh each control that you modified
    YourModalSheet.Content.Refresh
    'show the modal sheet
    Page.ShowModalSheet("yourmodalsheet")
End Sub

3. Call ShowChooseSheet()

This is just a simple example that works in my project ...
 
Upvote 0
Top