datatables icon indicating copy to clipboard operation
datatables copied to clipboard

await handler search?

Open BerndtDavid opened this issue 1 year ago • 3 comments

Hello - I have a 10,000+ row table. After entering a search phrase, it can take up two seconds to update the table. Is there a way I can track the search progress - so I can display some sort of status spinner while it's updating? Thanks.

models

BerndtDavid avatar Jun 14 '24 12:06 BerndtDavid

Hello, Depends on where data is updated.

  • Is it on server side, do you fetch data while user is searching?
  • Is it a client side search, you load 10_000 rows and apply search on it?

For both I guess there is a possibility but in different ways

vincjo avatar Jun 14 '24 15:06 vincjo

@vincjo Is there a workaround with serverside data at the moment?

iwazowsky avatar Jul 03 '24 12:07 iwazowsky

For example by adding a isLoading state in your data fetching function.
It requires to create a store.

handler.onChange(async (state) => {
    isLoading.set(true)
    // [await fetching data....]
    isLoading.set(false)
    return data
})

Not ideal but at least, you have access to a "pending" state each time your data is loaded.

vincjo avatar Jul 06 '24 08:07 vincjo