Premium support for our pure JavaScript UI components


Post by H9FFDC »

Hi,

According to the documentation, store.count returns the record count, including group headers and store.originalCount returns the record count, not including group headers.

However, store.originalCount is also returning group headers. This can be reproduced by adding the following to this example: https://www.bryntum.com/examples/grid/grouping/

console.log(grid.store.count, grid.store.originalCount);

Notice that both properties return 58 i.e. the number of data rows (50) plus the group headers (8).

Furthermore - we would like to be able to find out how many visible (non-special) records are in the grid i.e. it should not include group headers or filtered out records. Is there a suggested property / method that we can use for this? It seems that even if originalCount was ignoring group headers, that it would still include filtered records. Apologies if this in your documentation, I have looked but have struggled to find anything suitable. this.grid.store.records also includes the group headers so we can't simply check the size of this.

Many thanks!


Post by pmiklashevich »

Hello,

store.originalCount is also returning group headers. This can be reproduced by adding the following to this example: https://www.bryntum.com/examples/grid/grouping/

Reproduced, ticket here: https://github.com/bryntum/support/issues/2225

we would like to be able to find out how many visible (non-special) records are in the grid i.e. it should not include group headers or filtered out records

There is no such property or method right now. I've opened a ticket to create one: https://github.com/bryntum/support/issues/2227

Meanwhile there are 2 options how to workaround it. If you need only number of records you can calculate it using public API:

grid.store.count - grid.store.getGroupTitles().length

If you need to get records, you can try to use record.isSpecialRow check. Private, so please add a note to your code. We will discuss to make the property public.

// clone records to do not mutate the array!
records = [...grid.store.records].filter(r => !r.isSpecialRow)

Best,
Pavel

Pavlo Miklashevych
Sr. Frontend Developer


Post Reply