Power-Components / livewire-powergrid

⚡ PowerGrid generates modern, powerful and easy-to-customize data tables using Laravel Livewire.
https://livewire-powergrid.com
MIT License
1.46k stars 215 forks source link

Table does not refresh after adding , deleting or editing information(I am not using inline edit) #283

Closed Stridesdata closed 2 years ago

Stridesdata commented 2 years ago

First of all, did you see if your problem has happened to other people before?

Did you read the documentation ?

Is there an error in the console?

Describe the bug I use a modal component to edit and add new item to the database. Edit, delete and create functions are called by emit and grabbing the Id where necessary. All these works well but whenever I add, delete or edit, I have to refresh the page to see changes. I tried calling the Filldata() helper using an event listener but is still doesn't work.

Note.. This was also mentioned in the Laravel Daily review video

To Reproduce

Laravel version (exactly) 8.1 *

Livewire version (exactly) 2 *

AlpineJS: 3 *

Theme:

Screenshots (This helps to understand better)

Do you have any idea how we can fix it? No

Put part of your code, an html screenshot of the problem element:

Stridesdata commented 2 years ago

@luanfreitasdev @snapey @emtudo @trippo

Found a temporary work around. Noticed that on column toggle, the table refreshes while maintaining current state hence, I call the toggle event twice every time I update or delete a record.

I added the highlighted code below to my code and everything works fine

image

Let me know if there is a more efficient way

dansysanalyst commented 2 years ago

❗ @Stridesdata, please do not mention contributors unless they are actively working on the very same issue.

PowerGrid collaborators are volunteers. Drawing attention of random people will not make your issue get solved faster.

luanfreitasdev commented 2 years ago

Hi @Stridesdata , your approach is not wrong. however you can easily do this in the backend using events from one component to another.

Take a look at the demo repo. There is a modal and the table is updated.

https://github.com/Power-Components/powergrid-demo

Stridesdata commented 2 years ago

❗ @Stridesdata, please do not mention contributors unless they are actively working on the very same issue.

PowerGrid collaborators are volunteers. Drawing attention of random people will not make your issue get solved faster.

My apologies