B4J Question [ABMATERIAL] How update HTML tag content? SOLVED

clarionero

Active Member
Licensed User
Longtime User
Hi. I need update by websocket the content of a UL HTML tag with information about images. I search the tag id with GetElementByID and then create a JQueryElement and use SetHTML to update the tag content. This works fine only the first time. If i try to repeat the process to update again the data then GetElementByID doesn't found the tag and i can't update again.

Any idea?

Thank you

Rubén
 

clarionero

Active Member
Licensed User
Longtime User
Hi. After read again the Demo info i can response to me :). The solution is to use the helper methods of ABMaterial object to modify the HTML code from the page:

B4X:
   ' create a temporal ABMaterial variable
   Private ABM As ABMaterial 'ignore
   ' remove the tag it it exist in page HTML code
   ABM.RemoveHTML(InternalPage,$"playlist_${internalID}"$)
   ' Add the new HTML code to the page with the new images information
   ABM.AddHTMLToMain(InternalPage,TagsImagenes)

   
   Dim script As String = $"
     
   ...
   'javascript code using inserted the above HTML code
   ...  
     "$

   ' execute the javascript code
   InternalPage.ws.Eval(script, Array As Object(ABMComp.ID))

Now the page is updated with the new HTML code and the page is refreshed with new images

Woow, this is great :)

Great work Alain, this is better each new version !!!


Rubén
 
Upvote 0
Top