elastic / search-ui

Search UI. Libraries for the fast development of modern, engaging search experiences.
https://docs.elastic.co/search-ui
Apache License 2.0
1.92k stars 368 forks source link

Pagination: "Showing #-# out of #" text not update properly #951

Closed RickyRicardo17 closed 1 year ago

RickyRicardo17 commented 1 year ago

Describe the bug The "Showing #-# out of #" is showing the incorrect number of shown records. Currently this is only replicable when there are 11 records and the show count is set to 10. This does not effect the actual amount of records shown (still correctly only shows 10).

To Reproduce Steps to reproduce the behavior:

  1. Have a search result with 11 records.
  2. Filter to show only 10 items per page.
  3. Text does not update.

Expected behavior Text should change to "Showing 1-10 out of 11"

Screenshots

Screenshot 2023-03-08 at 1 59 38 PM

Which backends and packages are you using: Unsure as dev who created this was not me.

Bear with me as my only understanding of elastic has been through the process of searching for this bug. Code uses custom react but I was told that the variables are unchanged.

this is the piece of code that creates that text
                   view={({ start, end, totalResults, searchTerm }) => {
                        let end_string = searchTerm ? `for: <i>${searchTerm.replace(/<[^>]*>?/gm, '')}</i>` : ' documents';
                        return totalResults === 0 ?
                          <p className="failed-search"> {store.eq_vars.failSearchMessage} </p> :
                          <div className="paging-info" dangerouslySetInnerHTML={{__html:
                            `Showing <strong> ${start} - ${end} </strong>
                            out of <strong> ${totalResults.toLocaleString('en-US')} </strong>
                            ${end_string}` }}>
                          </div>
                      }}

This site is live: https://www.bigtwinfreighter.com/search?size=n_10_n Here's another site where the same code is used: https://www.milestoneaviation.com/search?size=n_10_n

Let me know what I should ask the dev for so I can provide you with more info.

botelastic[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Is this issue still important to you? If so, please leave a comment and let us know. As always, thank you for your contributions.

RickyRicardo17 commented 1 year ago

To late to mark this issue as still relevant?