9 Replies Latest reply on Jul 30, 2020 9:43 PM by Joe R

    Javascript Help for Disabling Row Selector on Interactive Grid

    Joe R

      Version: Application Express 19.2.0.00.18

       

      Hello,

       

      A co-worker just asked me for help with disabling the Row Selector on an Interactive Grid based on a condition.

      He currently has a function in the "Function and Global Variable Declaration" section to disable the Row Selector when the report loads, scrolls, or changes to another saved report.

      The problem is when sorting one of the columns. The function doesn't seem to be executed.

       

      Here's the Function:

      function disableRowSelector() {
          var records = $(".a-GV").first().find( ".a-GV-w-scroll .a-GV-row" );
          var eclipseUser = $("#P21_ECLIPSE_ID")[0].value;
          var userSSO = $("#P21_SSO_ID")[0].value;
          
          for(var i = 0; i < records.length; i++){
              var compareText = records.eq(i)[0].cells[4].innerText;
              var compareID = records.eq(i)[0].cells[5].innerText;
             
              //console.log("compareText: " + compareText);
              if (compareText === 'HOUSE' && compareID !== eclipseUser && compareID !== '-'){
                  var dataId = records.eq(i).attr("data-id");
                  
                  // Remove Checkbox from that row
                  $(".a-GV").first().find( ".a-GV-w-frozen .a-GV-row[data-id='" + dataId + "'] .u-selector").removeClass();
              }
              else if((eclipseUser === compareText || compareText === 'HOUSE' || compareText === '-') && compareText){
                   var dataId2 = records.eq(i).attr("data-id");
                 // $(".a-GV").first().find( ".a-GV-w-scroll .a-GV-row[data-id='" + dataId2 + "']").css("background-color", "#00FF00");
              } 
              else{
                  
                  // Get data-id of row where Eclipse User does not match Inside Sales Person
                   var dataId = records.eq(i).attr("data-id");
                  
                  // Remove Checkbox from that row
                  $(".a-GV").first().find( ".a-GV-w-frozen .a-GV-row[data-id='" + dataId + "'] .u-selector").removeClass();
              }
          }
      }
      

       

      Line 27 is where he's disabling the Row Selector.

      So again the issue is that this function doesn't seem to run when column sorting is applied on the report.

      Can someone help with this?

       

      Thanks,

      Joe