hjalmers / angular-generic-table

A generic table for Angular 2+. Generic table uses standard markup for tables ie. table, tr and td elements etc. and has support for expanding rows, global search, filters, sorting, pagination, export to CSV, column clicks, custom column rendering, custom export values.
https://hjalmers.github.io/angular-generic-table/
MIT License
105 stars 55 forks source link

Expand table #298

Open mayraGL opened 5 years ago

mayraGL commented 5 years ago

Hi @hjalmers

I have a table like this. The user can expand all the rows in the table. But when the table is lazy loading and changes the page the rows not showing expanded. There is any configuration to do it?

image

hjalmers commented 5 years ago

Hi @mayraGL, not sure if I get what you’re trying to do but do you want to persist the state of the table rows i.e. which table rows are expanded when a user refreshes the table or uses pagination?

When you’re lazy loading the data you have two options:

  1. Persist the state on the the server Let’s say the user clicks on a row to get more details, if you make a server request to fetch the details using an id, you could toggle a property for that item and return the state from the server and use it to determine if the row should be expanded or not.

  2. Persist the state in the client Same as the first option but instead of persisting the state on the server you store it locally in a service or local storage etc. and next time you fetch data you use the id’s stored locally to determine if the row should be expanded or not.

If I remember it correctly there should be an option to do number 2 by specifying a unique id that should be used but I have to look it up when I have access to the code.

But did I get your question right?

mayraGL commented 5 years ago

@Hi @hjalmers. I tried to persist in the client like this but didn't works

image