locked
Create a toggle button in popup to update a record. ie. mark a record complete w/out opening addeditScreen in HTML client. RRS feed

  • Question

  • Ok, so do we have to expose an addedit screen for the user to edit a boolean field or can we spare the user multiple clicks by adding a button in a popup to toggle the field value. From a user experience vantage, it would be best to have multiple toggle buttons to select a records status. For example, hit the check mark to mark record complete, or select a different toggle to not complet or escalated. 

    Approaches:

    Add a button - great for presetting a value in the addedit screen, but still requires the user to hit save even with beforeShown: or afterClose: events.

    Add toggle button as custom control - same as above, but can this access the pre-process query and LINQ to update the value. ie.

    partial void SEL_COMP_STAT_PreprocessQuery(int? parmWRKFLW_COMP_PK, ref IQueryable<WRKFLW_COMP> query)
            {
                query = query.Where(x => x.WRKFLW_COMP_PK == parmWRKFLW_COMP_PK);
               //not familiar with LINQ enough but think
               // query.myBoolField = True;
               // myapp.applyChanges(); or equivalent save function in LINQ
            }

    Or does this require a stored procedure. If so, that seems very complex to me.

    Thoughts? Help? Ponderances?

    -Cheers!

    Friday, March 18, 2016 5:37 AM

Answers

  • The button action was able to edit the records by implementing the myapp.applyChanges(); or myapp.commitChanges(); depending on the behavior desired. When closing the popup, I had to add a few other lines to refresh the objects.

    myapp.BrowsePipeline.MarkComplete_execute = function (screen) {
    
        var stat = screen.[the table object].selectedItem.COMP_STAT;
        // Show a message box, and respond to a user selection
        if (stat == 'C') {
            msls.showMessageBox("The step has already been marked complete, do you want to overwrite?", {
                title: "Overwrite prior completion",
                buttons: msls.MessageBoxButtons.yesNo
            }).then(function (result) {
                if (result === msls.MessageBoxResult.yes) {
                    screen.[the table object].selectedItem.COMP_STAT = 'C';
                    myapp.applyChanges();
                    screen.closePopup();
                    screen.[A tiled object].refresh();
                    screen.[the table onbject].load();
                }
    
                else if (result === msls.MessageBoxResult.no) {
                    alert("No action was taken");
                }
            });
        } else {
            screen.TSA_WRKFLW_COMPs1.selectedItem.COMP_STAT = 'C';
            myapp.applyChanges();
            screen.closePopup();
            screen.[A tiled object].refresh();
            screen.[the table onbject].load();
        }
    };


    • Marked as answer by FaithNoMore Monday, March 21, 2016 8:06 PM
    • Edited by FaithNoMore Monday, March 21, 2016 9:14 PM 1
    Monday, March 21, 2016 8:06 PM

All replies

  • Yes, you can do this.  Do you want to add this behavior to a browse screen with a table control?

    Definitely NOT in the pre-process query method.

    Friday, March 18, 2016 4:45 PM
  • Yes, Here is the table as of now. 'Mark Complete' is the oob button control. COMP_STAT is the field I'd like to update 'T' or 'F'.


    Thanks



    • Edited by FaithNoMore Monday, March 21, 2016 3:47 AM Clarity
    Friday, March 18, 2016 7:17 PM
  • The button action was able to edit the records by implementing the myapp.applyChanges(); or myapp.commitChanges(); depending on the behavior desired. When closing the popup, I had to add a few other lines to refresh the objects.

    myapp.BrowsePipeline.MarkComplete_execute = function (screen) {
    
        var stat = screen.[the table object].selectedItem.COMP_STAT;
        // Show a message box, and respond to a user selection
        if (stat == 'C') {
            msls.showMessageBox("The step has already been marked complete, do you want to overwrite?", {
                title: "Overwrite prior completion",
                buttons: msls.MessageBoxButtons.yesNo
            }).then(function (result) {
                if (result === msls.MessageBoxResult.yes) {
                    screen.[the table object].selectedItem.COMP_STAT = 'C';
                    myapp.applyChanges();
                    screen.closePopup();
                    screen.[A tiled object].refresh();
                    screen.[the table onbject].load();
                }
    
                else if (result === msls.MessageBoxResult.no) {
                    alert("No action was taken");
                }
            });
        } else {
            screen.TSA_WRKFLW_COMPs1.selectedItem.COMP_STAT = 'C';
            myapp.applyChanges();
            screen.closePopup();
            screen.[A tiled object].refresh();
            screen.[the table onbject].load();
        }
    };


    • Marked as answer by FaithNoMore Monday, March 21, 2016 8:06 PM
    • Edited by FaithNoMore Monday, March 21, 2016 9:14 PM 1
    Monday, March 21, 2016 8:06 PM