Skip to Main Content
Feature Request FR-3362
Product Area Page Components
Status CLOSED

4 Voters

checkbox should not change when not in edit mode in interactive grid

horluklgg Public
· Sep 14 2023

Idea Summary
In Interactive Grid when not in edit mode, you can click once on any editable cell and select the row/cell, but only cells with type checkbox is changed. Th checkbox gets selected and furthermore the edit mode still stays disabled, both behavior doesn't make sense. 

Use Case
If you have many coumn with checkboxes and navigate and try to select single rows and click on any checkbox then you change the value, even you are not in edit mode

Preferred Solution (Optional)
checkbox should not change the value, should be react like other types. When this is not possible, maybe then the grid should get into edit mode, so you can see that somethin is changed

We reviewed this idea carefully, and while it was interesting, we concluded that due to all the internal implications we need to take into account, it is unlikely to make its way into APEX.

Comments

Comments

  • ann-sofie.vikstrom.often OP 1.8 years ago

    I also have this issue in 23.1

     When having a checkbox item type in an interactive grid it is possible to check or uncheck and Save without being in Edit mode

  • kamal.daar OP 1.8 years ago

    On select change when you place a cursor on a row should not select the checkbox, unless you explicitly check it.

  • karel ekema OP 6 months ago

    The checkbox gets selected and furthermore the edit mode still stays disabled

    If a bit of custom code is ok for you, you can automatically switch to Edit Mode upon clicking the checkbox. To my view, this should be the standard behavior in APEX.

    (function($) {
       // Set up generic construct as to process any checkbox value changes 
       // in any IG on the page where the IG is not in edit mode. 
       // The IG is put in edit mode, and the change event on the checkbox 
       // is triggered. This fills the gab in APEX.
       $('#main').on("interactivegridviewmodelcreate", function(jQueryEvent, data){  
           let igConfig = $(jQueryEvent.target).interactiveGrid('option').config;
           let igStaticId = igConfig.regionStaticId;
           let gridView = $(jQueryEvent.target).interactiveGrid('getViews').grid;        
           let model = data.model;
           model.subscribe({
               onChange: function(changeType, change) {
                   if (changeType == 'set')
                   {
                       let gridOptions = gridView.view$.grid('option');
                       if (gridOptions.editable && gridOptions.allowEditMode)
                       {
                           let currentViewId = apex.region(igStaticId).call('getCurrentViewId');
                           // if not in edit mode, check if a checkbox value was changed
                           if ((currentViewId == 'grid') && !gridView.view$.grid('inEditMode'))
                           {
                               let columns = gridView.view$.grid('getColumns');
                               let elementId = columns.find(c=>c.property == change.field).elementId;
                               let itemType = apex.item(elementId).item_type;
                               if (itemType == 'SINGLE_CHECKBOX')
                               {                           
                                   // to be sure, check old vs new value
                                   let oldValue = change.oldValue;
                                   let newValue = model.getValue(change.record, change.field);
                                   if (newValue != oldValue)
                                   {
                                       // let row selection finish and then enable IG edit mode and fire checkbox change event                             
                                       setTimeout(()=>{
                                           apex.region(igStaticId).call("getActions").set("edit", true); 
                                           apex.event.trigger('#'+elementId, 'change', null); 
                                       }, 10);
                                   }
                               }
                           }
                       }
                   }
               }
           });
       });   
    })(apex.jQuery);