I am trying to hide a Interactive Grid region when there are no rows, and display it when there are rows…
I have like 8 regions with different IGs an depending on the data selected, only a few will have data.. so I am trying to just display the ones that have data and hide when they dont.
The page is set up with 2 select lists and multiple regions
I pick item one in select list 1, this loads sublist in select 2 as well as data in IG 1,
I pick an item in select list 2, this loads data in the IG 2, then if there is data MRCIG, OCCIG, etc etc..
its the MRCIG, OCCIG etc that I want to hide or show if there is data.
Ive tried a number of ways and nothing works so far!
i thought this might work…triggered on page change IG..
ig = apex.region("OCCIG").widget().interactiveGrid("getCurrentView");
model = ig.model;
records=model.getTotalRecords();
alert(records);
if (records > 0) {
apex.region("OCCIG").hide();
};
i put the alert to check that it sees the count, it did… but doesnt hide it (i set it to hide on results just to see if it worked)
I tried hiding the region when I pick a top level data (kind of a drill down) in a select list.. but then the page change doesnt trigger…
So… please experts! How can I pull this off!
Thanks!!
EDIT
it seems this would work.. if I could trigger it
var totalRec = apex.region("OCCIG").widget().interactiveGrid("getViews", "grid").model.getTotalRecords();
alert(totalRec);
if (totalRec > 0 )
{
$('#OCCIG').css("visibility","visible");
} else {
$('#OCCIG').css("visibility","hidden");
}
the problem is, nothing triggers when its empty. PAGE CHANGE works when it has data, but not when its empty…