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
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.