Hi @johnny , i need your help, using gc without any framework.
The backend works great, it is more about the frontend.
Lets say i have some content, three buttons and a div especially for the datagrid. With each button i want to “select” a different table, and display the datagrid in the “gc-div”, without reloading the rest of the page. I can do it by reloading everything, and i guess using a controller and a view in codeigniter would do also, but i have the restriction to not use any framework.
What code should i use in the onclick of the buttons, to be able to send the datagrid to the div without having to reload the rest…
Thanks in advance for any hint
Marc
post by MarcVdB on Jun 20, 2024
post by johnny on Jun 21, 2024
Hello @MarcVdB ,
Yes you can do that. It needs first steps for this.
- Use the setUniqueId function to have a uniqueId for each of your datagrids setUniqueId | Grocery CRUD - A PHP CRUD Generator Library let’s say:
$crud->setUniqueId("customers_1234");
- Now you can specify you can refresh your datagrid by having the below JavaScript call:
groceryCrudLoader(document.querySelectorAll('.grocery-crud[data-unique-id="customers_1234"]')[0]);
Considering that customers_1234 is the uniqueId you have provided in the first step.
The above code will refresh only the datagrid you have specified. I hope this helped.
Regards
Johnny
post by MarcVdB on Jun 21, 2024
Hi Johnny,
i think setUniqueId was the clue i was missing. Will have time this weekend to look at it.
In anyway, thanks for your quick response!
Regards,
Marc
New & Unread Topics
| Topic | Replies | Views | Activity | |
|---|---|---|---|---|
| Use callbackColumn() but keep inline edit functionality |
|
3 | 648 | Apr 12 |
| Setting quick search values via JavaScript not working properly for booleans |
|
0 | 563 | Nov 2025 |
| callbackColumn() has not effect in v3.2.6 Enterprise |
|
2 | 695 | Dec 2025 |
| Inline edit has problems if the column width is set |
|
2 | 842 | Feb 28 |
| “Ooooops, something went wrong! If you can see this message, this is probably a misconfiguration in Grocery CRUD Enterprise!” |
|
6 | 264 | 8d |