GridView get number of rows with jQuery

Hi there everybody!

Today I was wondering whether there is a way to get the total number of rows (not the checkbox selected ones) in a GridView using the yiiGridView javascript Widget. I have checked here but I didn’t find what I was looking for, so far I have achieved this by printing the number of rows in a data-count attribute from the dataProvider object:

{{ void(pjax_begin({ 'id' : 'activities-container' })) }}

    {{  grid_view_widget({

      'dataProvider' : dataProvider,

      'options' : { 'id' : 'activities-index', 'data-count' : dataProvider.getTotalCount() },

      'columns' : [...]

    }) | raw }}

{{ void(pjax_end())}}

The JavaScript:

$('#some-button-id').on('click', function(e){


   let rows = $('#activities-index').data('count');



Thanks in advance