2 Replies Latest reply on Mar 26, 2020 7:05 PM by ostrowskibartosz

    Interactive Grid - highlighting cells in APEX 18, 19 and 20

    ostrowskibartosz

      I've got problem with Interactive Grid JavaScript API cross APEX versions.

       

      First of all I've started with this old thread:

       

       

      from which I've learned how I can use model field meta data to add custom classes to IG cell.

       

      To make it simple let's say I have dynamic action bound to custom event addValidClass with true action Execute JavaScript Code defined as below:

       

      var
        region = $(this.browserEvent.target),
        grid = region.interactiveGrid('getViews').grid,
        meta = grid.model.getRecordMetadata( this.data.recordId );
      
      if ( !meta.fields.hasOwnProperty( this.data.column ) ) {
        meta.fields[ this.data.column ] = {};
      }
      
      meta.fields[ this.data.column ].highlight = "validValue";
      grid.view$.grid("refresh");
      

       

      I'm triggering this dynamic action using the code:

       

      apex.event.trigger( $('#grid_ig').get(0), 'addValidClass', {recordId: 7839, column: 'ENAME'} )
      

       

      My problem is that this code works as expected in APEX 19 and 20 but in APEX 18.1.0.00.45 it doesn't.

       

      My observations:

      • when cell value is not changed I can change the cell class as many times I want - works every time
      • when cell value is modified the rendered grid table doesn't add given class
        • when checking model meta data for this row and column I can see the property highlight is set
      • when I save the grid using SAVE button then grid renders cells with classes I've assigned

       

      Is it bug? Is there workaround I can use for APEX 18?

       

      Regards

      Bartosz

        • 1. Re: Interactive Grid - highlighting cells in APEX 18, 19 and 20
          John Snyders-Oracle

          Hi Bartosz,

           

          I believe that 18.1 did not do a good job of refreshing the row or cell css classes when the model changed. I think this was first fixed in 18.2. I don't think there was a bug number associated with this improvement. I don't have an old 18.1 handy to test with but I can see this from looking at code diffs. You can compare the code from 18.1 and 19.1 and you will see that one has a getCellClass function and the older one does not.

           

          I recommend upgrading to a later version of APEX if at all possible.

           

          You may be able to work around this by forcing the row to re-render itself by calling the internal method _replaceRecord. This is why it shows correctly after save; because save results in the row being re-rendered. Because it is an old release, internal methods and something that is fixed I can't investigate this workaround. You can probably figure out how to use _replaceRecord by looking at the code.

           

          Regards,
          -John

          • 2. Re: Interactive Grid - highlighting cells in APEX 18, 19 and 20
            ostrowskibartosz

            Thank you John for the reply. Your answer is enough for me, just needed to know whether I can consider it as the bug or not.