Subgrid not reloading after insert (blank grid with no records message)

QuestionsSubgrid not reloading after insert (blank grid with no records message)
Stan asked 9 years ago

Hi Abu, I ve' tried some different methods, but I couldn't manage to get the subgrid to refresh after inserting a record. I get a blank subgrid instead with no records message.
If I manually reload the master grid with your button example (see link below), it works, but it should be done automatically after inserting a record in the subgrid, not by pressing the extra button.

https://phpgrid.desk.com/customer/portal/questions/2352710-dropdown-subgrid

If I remove the Custom SQL query in my subgrid_detail.php,

($g->select_command = "select * FROM bundles_de WHERE i2_art_parent = '$id'";)

inserting (& refreshing) works, but the skript shows (on expanding the master record) all records of the subgrid and not only the records coresponding to the $id.
I'm using your code snippet to store the $id in the session.

if (!empty($_POST["id"]))
$_SESSION["id"] = $_POST['id'];

$id = $_SESSION['id'];

What am I doing wrong ?

Thanks for your help

1 Answers
Abu Ghufran answered 9 years ago

Hello,

You don't need to use SESSION snippet for subgrid because the id is passed from parent in url every time you open subgrid.
Simple solution would be to use persistance plugin. It will auto expand subgrid on parent refresh.

<script>
// to auto expand subgrid on refresh
var opts = {
"stateOptions": {
storageKey: "gridState-list-subgrid",
columns: true, // remember column chooser settings
selection: true, // row selection
expansion: true, // subgrid expansion
filters: true, // subgrid expansion
pager: true, // page number
order: true // field ordering
}
};
</script>

For reference, refer deoms/master-detail/subgrid.php
Also emailing you latest demo files.

Your Answer

8 + 6 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?