A weird behavior for LABKEY.ext.Store (or its parent)?

LabKey Support Forum (Inactive)
A weird behavior for LABKEY.ext.Store (or its parent)? Greg Taylor  2014-08-07 15:56
Status: Closed
 
Hi Leo,

When I run the script using LABKEY.ext4.Store on my development system running 14.3 trunk I do not see a discrepancy in the demo study that I am working with. The script reports 6 entries for the first statement and 6 entries for the last. When I run the script using LABKEY.ext.Store I see the discrepancy that you previously observed (responses of 6 and 1).

After investigating further, it appears that you want to log 's.getTotalCount()' instead of 's.getCount()' for the case where you are using ext3. Switching to ext4 is also recommended.

Greg

Below is the ext3 documentation on getCount()

getCount( ) : Number
Gets the number of cached records.

If using paging, this may not be the total size of the dataset. If the data object used by the Reader contains the dataset size, then the getTotalCount function returns the dataset size. Note: see the Important note in load.

Available since: 1.1.0


SAMPLE SCRIPT
<script type="text/javascript">

new LABKEY.ext4.Store({
 schemaName: 'study',
 sql: "Select Name From study.DataSets WHERE CategoryId.Label = 'Assays'",
 listeners: {
  load: function(s){ console.log(s.getCount()); },
 },
 autoLoad: true
})

LABKEY.Query.executeSql({
 schemaName: 'study',
 sql: "Select Name From study.DataSets WHERE CategoryId.Label = 'Assays'",
 success: function(d){ console.log(d.rows.length); }
})

</script>