How do I hide grid if it has no rows?

I have five interconnected tables and five combos that all populate with their data. I also have six grids that show related information based on the information selected in one of the five combos. (Selecting data in one combo clears the other combos.) Not every selection in a combo ends up with data in all six grids.

What I want to do is hide a grid if there is no data to be displayed. How can I find out if a grid is empty? Here is the code attached to one of the combos:

[code]var act=new dhtmlXCombo(“act_combo”,“active”,200);

function newActive(){
actgrid.clearAndLoad("./active_connector.php?un=" + act.getActualValue());
pegrid.clearAndLoad("./pharmaeffect_connector.php?un=" + act.getActualValue());
moagrid.clearAndLoad("./methodofaction_connector.php?un=" + act.getActualValue());
cigrid.clearAndLoad("./chemicalingredient_connector.php?un=" + act.getActualValue());
epcgrid.clearAndLoad("./establishedpharmaclass_connector.php?un=" + act.getActualValue());
labgrid.clearAndLoad("./label_connector.php?un=" + act.getActualValue());
Somewhere after the clearAndLoad, I would like to put a turn a grid’s div tag invisible if the grid is empty, but how do I find that out?

You can get number of rows in grid and if it “0” hide the grid:

var count=mygrid.getRowsNum();

I’ve tried the following, but it doesn’t work:

pegrid.clearAndLoad("./pharmaeffect_connector.php?un=" + act.getActualValue(), function(){ if (pegrid.getRowsNum > 0) { document.getElementById('pecon').style.visibility = 'visible'; } else { document.getElementById('pecon').style.visibility = 'hidden'; }}); All my grids disappear. What am I doing wrong?

getRowsNum() is a method, not a property:


Thanks! Boy, do I feel dumb! :slight_smile: