• If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Announcement

Collapse
No announcement yet.

Error with given script on mobile

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Error with given script on mobile

    I have a startup script provided from you guys in this post:
    Is there any way to cause an app variable to change, say from true to false, whenever a user has a checkbox selected that is part of an edit grid (using the widget settings "Checkbox row Selection" option) and also switch the variable back if they uncheck the box?


    The script lets me check and uncheck a row in a grid to change an app variable. That app variable is tied to enabling and disabling buttons on a separate widget so that the user can only click the buttons if a row is checked in the grid.

    It seems that the script is only partially working on mobile: once a row is check, the buttons do enable, which is good, but after unchecking the box the buttons stay enabled, and I can't seem to find a way to make them disable.

    Is there any changes to the script I could make so that it works on mobile? it seems to be working fine on desktop. Alternatively I know you guys mentioned in the previous forum post that you would add it as a feature request, so is there possibly a cleaner way of doing it at this point?

    Thanks

  • #2
    Updated script:

    Code:
    var testAppVar     = getAppVar('testAppVar'),
        editGridWidget = getWidget('myEditGrid');
    
    editGridWidget.down('grid').on('selectionchange', function (sm, selected) {
        const sel = sm.getSelected();
        
        if (sel.length > 0) {
            setAppVar('testAppVar', true);
        } else {
            setAppVar('testAppVar', false);
        }
    });
    
    success();

    Comment

    Working...
    X