A variable of a dataregion associated with a QueryWebPart is not set properly

LabKey Support Forum (Inactive)
A variable of a dataregion associated with a QueryWebPart is not set properly Leo Dashevskiy  2016-03-02 12:44
Status: Closed
 
qwpDataset = new LABKEY.QueryWebPart({
    frame: 'none',
    queryName: dataset,
    renderTo: 'someDiv',
    schemaName: schemaName
});

In the button bar using the "PAGE SIZE" drop-down menu pick "Show All", then in the console:


dataregion = qwpDataset.getDataRegion();

console.log( dataregion.totalRows );
> null


For other "PAGE SIZE" drop-down numeric menu options, the value is set correctly.
I'm relying on it to see if the dataregion/QueryWebPart is empty or not (without requerying anything).
If there's an alternative way to tell, I'd like to hear about it.

So far I'll have to rely on querying the DOM for "tr.labkey-alternate-row" and "tr.labkey-row" and summing them up :(
 
 
Will Holtz responded:  2016-03-02 14:08
Is this any better?
var numRows = dataRegion.table.dom.rows.length-4;

The -4 is for header rows. If you have the button bar turned off, or top and bottom button bars, then you may require a different constant here.

-Will
 
Leo Dashevskiy responded:  2016-03-02 15:50
Thanks, Will!

I does help a bit, though, in the case, where the numeric value is selected for pagination, it will produce the number of rows on the current page (just like dataregion.rowCount) and not the total number of rows in the table (like dataregion.totalRows), so some if-else statements are needed.

I don't understand, why the "totalRows" value is not assigned correctly for the non-paginated case...
 
Leo Dashevskiy responded:  2016-07-29 11:05
So shouldn't "totalRows" of a DataRegion be set correctly in all possible situations, including "Show All" rows setting?

Can you guys fix this? Unless there are objections...

Thanks.
-Leo
 
Jon (LabKey DevOps) responded:  2016-08-02 14:03
Hi Leo,

I'll get a bug submitted. It really should include totalRows.

Regards,

Jon
 
Jon (LabKey DevOps) responded:  2016-08-02 14:37
 
Jon (LabKey DevOps) responded:  2016-10-14 00:11
Hello Leo,

The bug has been fixed in the 16.3 release of LabKey which will be available sometime mid-November.

Regards,

Jon
 
Leo Dashevskiy responded:  2016-10-14 11:47
Great news, thank you! Jon, can you just let me know, please, what is the revision number where it became available?
 
Jon (LabKey DevOps) responded:  2016-10-14 11:59
Hi Leo,

It's under r46023

Regards,

Jon