Incremental Scrolling Table - Displaying Record Count

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

Incremental Scrolling Table - Displaying Record Count

Postby Louis.Winter » Thu Aug 01, 2019 5:09 pm

Hello,

We have a number of forms that we want to display the number of records found at the bottom. When the number of records (filtered) is under the foundst.pkChunkSize, the count displays correctly. My issue is when there are more records than the current foundset.pkChunkSize, the count displays 200 (foundset.pkChunkSize value). When I scroll to the bottom and the foundset fetches more, the count doesn't change and I can't find any events on the table (servoyextra-table) or the foundset to trigger updating the count.

Has anyone else found a workaround or solution to this type of issue?

Thanks,
Louis
Louis Winter
Journey Technology Solutions
Sioux Falls, SD USA
Louis.Winter
 
Posts: 24
Joined: Thu Dec 13, 2018 8:10 pm

Re: Incremental Scrolling Table - Displaying Record Count

Postby kwpsd » Thu Aug 01, 2019 6:24 pm

Hi, Louis.

Have a look at the following code (call using onRecordSelection of the various forms):

Code: Select all
function displayRecordStatus( formName )
{
    if ( !formName ) return ''
   
   
    // Get the number values.
   
    var currentRecordIndex = forms[ formName ].foundset.getSelectedIndex()
   
    var numberOfRecordsInFoundset = forms[ formName ].foundset.getSize()
   
    var totalRecordsInTable = databaseManager.getFoundSetCount( forms[ formName ].foundset )
   
   
    // String format the numbers.
   
    var sIndex = utils.numberFormat( currentRecordIndex, '#,###' )
   
    var sFoundset = utils.numberFormat( numberOfRecordsInFoundset, '#,###' )

    var sTotal = utils.numberFormat( totalRecordsInTable, '#,###' )

   
    // Return the formatted string.
   
    return 'Item ' + sIndex + ' of ' + sFoundset + ' (out of ' + sTotal + ')'
}
Kim W. Premuda
San Diego, CA USA
User avatar
kwpsd
 
Posts: 687
Joined: Sat Jul 28, 2007 6:59 pm
Location: San Diego, CA USA

Re: Incremental Scrolling Table - Displaying Record Count

Postby Louis.Winter » Thu Aug 01, 2019 8:54 pm

Thanks Kim, this worked great!
Louis Winter
Journey Technology Solutions
Sioux Falls, SD USA
Louis.Winter
 
Posts: 24
Joined: Thu Dec 13, 2018 8:10 pm


Return to Programming with Servoy

Who is online

Users browsing this forum: alasdairs and 13 guests