B4J Question [BANano] SetField & SetAttr using JSON

Discussion in 'B4J Questions' started by Mashiane, Aug 21, 2019.

  1. Mashiane

    Mashiane Expert Licensed User

    Hi there

    Whilst SetStyle is able to receive a JSON value to apply the styles to it. Is it possible to implement similar for .SetField and .SetAttr so that they receive a JSON string / Map Object.

    This can greatly help in setting up multiple fields and multiple attributes at the same time.

    For example...

    Code:
    Dim canvas1 As BANanoElement = body.Append($"<canvas id="mycanvas"><canvas>"$).Get("#mycanvas")
        canvas1.SetAttr(
    "width","600")
        canvas1.SetAttr(
    "height","400")
        canvas1.SetText(
    "Your browser does not support the HTML 5 Canvas.")
        canvas1.SetStyle(BANano.ToJson(CreateMap(
    "border":"1px solid black")))
    It could be

    Code:
    canvas.SetAttr1(BANano.ToJSON(CreateMap("width":"600","height":"400))))
    Ta!
     
    joulongleu likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice