Sunday 17 February 2019

APEX 18.2 and IG Detail view after refresh DA

APEX 18.2 and IG Detail view after refresh

 

How to catch after refresh of your IG detail view?

 

Interactive grid Detail view after refresh DA


Another post from the factory last week on IG Detail view

Perfect we got IG Detail view up and running now using images. What we want to do next is trigger a DA when IG Detail view region refreshes.


Let's say we wanted to run an after refresh process. 

How do we do this? 
If you look at documentation on 18.2 Interactive Grid widgets there is loads to figure out. 

From blogs and online documentation initial attempt was to try utilizing known event listeners like  

.on( "interactivegridmodechange", function( event, data ) { console.log(1, event, data); } );
.on( "interactivegridreportchange", function( event, data ) { console.log(2, event, data); } );
.on( "interactivegridreportchange", function( event, data ) { console.log(3, event, data); } );
.on( "interactivegridsave", function( event, data ) { console.log(4, event, data); } );
.on( "interactivegridselectionchange", function( event, data ) { console.log(5, event, data); } );
.on( "interactivegridviewchange", function( event, data ) { console.log(6, event, data); } );
.on( "interactivegridviewmodelcreate", function( event, data ) { console.log(7, event, data); } );
.on( "gridmodechange", function( event, data ) { console.log(8, event, data); } );
.on( "gridreportchange", function( event, data ) { console.log(9, event, data); } );
.on( "gridreportchange", function( event, data ) { console.log(10, event, data); } );
.on( "gridsave", function( event, data ) { console.log(11, event, data); } );
.on( "gridselectionchange", function( event, data ) { console.log(12, event, data); } );
.on( "gridviewchange", function( event, data ) { console.log(13, event, data); } );
.on( "gridviewmodelcreate", function( event, data ) { console.log(14, event, data); } );

But after running this statement in browser console

apex.region("people_ig").refresh();
    
Indicates that none actually trigger after data has been refresh on Detailed view. So plan #1 is no good. 

Alternative, again thanks to a good man Shaun Mauer we came up with plan B. 

$(function() {
    var igGrid$ = $("#people");
    igGrid$.on("interactivegridviewmodelcreate", function(event, ui) {
     var model = ui.model;
     if (ui.viewId === "detail") {
         sid = model.subscribe( {
              onChange: function(type, change) {
                 console.log(15, ui.viewId, type, change, event,ui);
              }
         });
     }
   });
});

 
 which was shown incorrect as it was not triggering after region refreshed.

 After a brief discussion John Snyders came with the correct widget.  

apex.region("people").widget()
       .on("tablemodelviewpagechange", function(event, data) { 
            console.log("Page change ", data); 
});

Big thanks to all who participated getting to here and hope we will save someone time having it in a blog too.

Happy APEXing,
Lino

No comments:

Post a Comment