B4J Question ABMTable: problem with themes and InputMask property

Mr_fifty4

Member
Licensed User
hi,

i found a problem using themes with ABMtable. In detail I have defined a theme also using the inputmask property:
(the code was written starting from "HelperTablePage" in ABM demo project)

B4X:
    theme.Table("tbl1theme").AddCellTheme("IPnocoloredit")
    theme.Table("tbl1theme").Cell("IPnocoloredit").BackColor = ABM.COLOR_WHITE
    theme.Table("tbl1theme").Cell("IPnocoloredit").ActiveBackColor = "dragonfly"
    theme.Table("tbl1theme").Cell("IPnocoloredit").ActiveBackColorIntensity = ABM.INTENSITY_LIGHTEN2
    theme.Table("tbl1theme").Cell("IPnocoloredit").Align = ABM.TABLECELL_HORIZONTALALIGN_RIGHT
    theme.Table("tbl1theme").Cell("IPnocoloredit").IsEditable = True
    theme.Table("tbl1theme").Cell("IPnocoloredit").InputMask = "'mask':'999.999.999.999'"
    theme.Table("tbl1theme").Cell("IPnocoloredit").AllowEnterKey = True



in ConnectPage i wrote this code:

B4X:
    For i = 0 To 7
        Dim r As List
        Dim rCellThemes As List
        r.Initialize
        rCellThemes.Initialize

        r.Add(Main.SQL3.ExecQuerySingleResult("SELECT System FROM CFG_SystemTable WHERE rowid =" & (i+1) ))
        rCellThemes.Add("nocolor") ' nocoloredit
        r.Add(Main.SQL3.ExecQuerySingleResult("SELECT Description FROM CFG_SystemTable WHERE rowid =" & (i+1) ))
        rCellThemes.Add("nocolor") ' nocoloredit
        r.Add(Main.SQL3.ExecQuerySingleResult("SELECT IPAddr FROM CFG_SystemTable WHERE rowid =" & (i+1) ))
        rCellThemes.Add("IPnocoloredit") '
        r.Add(Main.SQL3.ExecQuerySingleResult("SELECT SubID FROM CFG_SystemTable WHERE rowid =" & (i+1) ))
        rCellThemes.Add("nocolor") ' nocoloredit
        r.Add(Main.SQL3.ExecQuerySingleResult("SELECT Port FROM CFG_SystemTable WHERE rowid =" & (i+1) ))
        rCellThemes.Add("nocolor") ' nocoloredit
       
        Dim switchactive As ABMSwitch
        Dim SWstate As Boolean
        If  Main.SQL3.ExecQuerySingleResult("SELECT Enable FROM CFG_SystemTable WHERE rowid =" & (i+1) ) ="0" Then
            SWstate=False
        Else
            SWstate=True
        End If
       
        switchactive.Initialize(page, "switchactive", "ON", "OFF", SWstate, "switch")
        r.Add(switchactive)
        rCellThemes.Add("nocolor")
       
        tbl1.AddRow("uid" & i, r)
        tbl1.SetRowThemes(rCellThemes) ' make sure you have as many items in rCellThemes as in r!
       
    Next

the output is this:

immagine_2022-01-20_094624.png



inputmask formatting is applied to the first row only.

I tried with the ABMaterial library version 4.30 and also with the latest 4.95 (updated also www folder).
I don't understand if I'm doing something wrong or it's a library problem

thanks for some helps
 
Solution
I don't think your browser is using the new .js file and is still using the buffered one. Try CTRL + 5 or set in the browser console to reload. I've tested it here with the demo app and it does work. What you see is still the old error.

Mr_fifty4

Member
Licensed User
thanks for your reply.

yes, console log show an error:

B4X:
HelperTablePage.1642682583786.js:28 ready to connect the websocket
core.4.39.min.js:86 Using RobustWebSocket
core.4.39.min.js:90 WebSocket opened, reconnected?: false
jquery.inputmask.bundle.3.01.min.js:1 Uncaught DOMException: Failed to execute 'getRangeAt' on 'Selection': 0 is not a valid index.
    at M (http://localhost:51042/js/jquery.inputmask.bundle.3.01.min.js:1:22159)
    at H (http://localhost:51042/js/jquery.inputmask.bundle.3.01.min.js:1:19894)
    at J (http://localhost:51042/js/jquery.inputmask.bundle.3.01.min.js:1:21493)
    at ea (http://localhost:51042/js/jquery.inputmask.bundle.3.01.min.js:2:3601)
    at h (http://localhost:51042/js/jquery.inputmask.bundle.3.01.min.js:2:5527)
    at HTMLTableCellElement.<anonymous> (http://localhost:51042/js/jquery.inputmask.bundle.3.01.min.js:2:9005)
    at Function.each (http://localhost:51042/js/core.4.39.min.js:744:42)
    at b.mask (http://localhost:51042/js/jquery.inputmask.bundle.3.01.min.js:2:8615)
    at HTMLTableCellElement.<anonymous> (http://localhost:51042/js/jquery.inputmask.bundle.3.01.min.js:2:12537)
    at Function.each (http://localhost:51042/js/core.4.39.min.js:744:42)

point 2: confirm the problem when i try to change the data: in row 1 show the mask , from row 2 don't show the mask.
 
Upvote 0

alwaysbusy

Expert
Licensed User
Longtime User
Download this file, unzip it and replace the existing one in the www\js folder: http://gorgeousapps.com/jquery.inputmask.bundle.3.01.min.zip

Change your InputMask to:
B4X:
theme.Table("tbl1theme").Cell("IPnocoloredit").InputMask = "'alias': 'ip','placeholder': '_._._._'"

This is about as close as I can get with this javascript library.

Alwaysbusy
 
Upvote 0

Mr_fifty4

Member
Licensed User
Replaced file and changed mask but only first row seems to work.

immagine_2022-01-21_104950.png



tested with only one row (it works even if with errors)

immagine_2022-01-21_111022.png




are there any other test to better understand this issue?
(bebore leaving inputmask)

thanks
 
Upvote 0
Top