Get KoolPHP UI with 30% OFF!

how to edit a record in the detail section of a master/detail grid

Brain
Hello,
please can someone show me how to enable the edit event and get it to show the form on the Orders table in the snapshot below

I tried in this code snippet below and it did not work as expected but displayed an empty form with the save and cancel button
<?php
require $KoolControlsFolder."/KoolAjax/koolajax.php";
$koolajax->scriptFolder = $KoolControlsFolder."/KoolAjax";
 
	require $KoolControlsFolder."/KoolGrid/koolgrid.php";
	require $KoolControlsFolder."/KoolGrid/ext/datasources/MySQLiDataSource.php";
	$ds_customer = new MySQLiDataSource($db_con);//This $db_con link has been created inside KoolPHPSuite/Resources/runexample.php
	$ds_customer = new PostgreSQLDataSource($db_con);//This $db_con link has been created inside KoolPHPSuite/Resources/runexample.php
	$ds_customer->SelectCommand = "select customerNumber,customerName,phone,city from customers";
    
 
	$grid_customer = new KoolGrid("grid_customer");
	$grid_customer->scriptFolder = $KoolControlsFolder."/KoolGrid";
	$grid_customer->styleFolder = "office2010blue";
	$grid_customer->Width = "655px";
	$grid_customer->RowAlternative = true;
	$grid_customer->AjaxEnabled = true;
	$grid_customer->AllowSelecting = true;
    $grid_customer->MasterTable->ShowFunctionPanel = true;
    $column = new GridEditDeleteColumn();
    $column->ShowDeleteButton = false;
    $column->OnClick = "grid_edit(this)";
    $column->ConfirmButtonText = "Confirmation Edited Values";
    $grid_customer->MasterTable->AddColumn($column);
 
	$grid_customer->AjaxLoadingImage =  $KoolControlsFolder."/KoolAjax/loading/5.gif";
 
	$grid_customer->MasterTable->DataSource = $ds_customer;
	$grid_customer->MasterTable->AutoGenerateColumns = true;
 
	$grid_customer->MasterTable->Pager = new GridPrevNextAndNumericPager();
    $grid_customer->AllowEditing = true;
    $grid_customer->MasterTable->EditSettings->Mode = 'form';
    $grid_customer->MasterTable->EditSettings->InputFocus = "HideGrid";
    $grid_customer->ClientSettings->ClientEvents["OnBeforeRowStartEdit"] = "Handle_OnBeforeRowStartEdit";
    $grid_customer->ClientSettings->ClientEvents["OnRowCancelEdit"] = "Handle_OnRowCancelEdit";
	$grid_customer->ClientSettings->ClientEvents["OnRowSelect"] = "Handle_OnRowSelect";
 
 
	$grid_customer->Process();
 
 
	$ds_order = new PostgreSQLDataSource($db_con);//This $db_con link has been created inside KoolPHPSuite/Resources/runexample.php
 
	if(isset($_POST["customer_selected"]))
	{
		$ds_order->SelectCommand = "select orderNumber,orderDate,status,customerNumber from orders where customerNumber=".$_POST["customerNumber"];		
		$_SESSION["customerNumber"] = $_POST["customerNumber"];
	}
	else
	{
		if(!$koolajax->isCallback)
		{
			$_rows = $grid_customer->GetInstanceMasterTable()->GetInstanceRows();
			$_rows[0]->Selected = true;			
			$ds_order->SelectCommand = "select orderNumber,orderDate,status,customerNumber from orders where customerNumber=".$_rows[0]->DataItem["customerNumber"];		
		}
		else
		{
			$ds_order->SelectCommand = "select orderNumber,orderDate,status,customerNumber from orders where customerNumber=".$_SESSION["customerNumber"];					
		}
	}
 
 
	$grid_order = new KoolGrid("grid_order");
	$grid_order->scriptFolder = $KoolControlsFolder."/KoolGrid";
	$grid_order->styleFolder = "office2010blue";
	$grid_order->Width = "655px";
	$grid_order->RowAlternative = true;
	$grid_order->AjaxEnabled = true;
	$grid_order->AjaxLoadingImage =  $KoolControlsFolder."/KoolAjax/loading/5.gif";
 
    $grid_order->MasterTable->ShowFunctionPanel = true;
	$grid_order->MasterTable->DataSource = $ds_order;
	$grid_order->MasterTable->AutoGenerateColumns = true;
    
    $columnn = new GridEditDeleteColumn();
    $columnn->ShowDeleteButton = false;
    $columnn->OnClick = "grid_edit(this)";
    $columnn->ConfirmButtonText = "Confirmation Edited Values";
    $grid_order->MasterTable->AddColumn($columnn);
    $grid_order->AllowEditing = true;
    $grid_order->MasterTable->EditSettings->Mode = 'form';
    $grid_order->MasterTable->EditSettings->InputFocus = "HideGrid";
    $grid_order->ClientSettings->ClientEvents["OnBeforeRowStartEdit"] = "Handle_OnBeforeRowStartEdit";
    $grid_order->ClientSettings->ClientEvents["OnRowCancelEdit"] = "Handle_OnRowCancelEdit";
	$grid_order->MasterTable->Pager = new GridPrevNextAndNumericPager();
	$grid_order->Process();
?>
 
<form id="form1" method="post">
	<?php echo $koolajax->Render();?>
 
	<script type="text/javascript">
		function Handle_OnRowSelect(sender,args)
		{
			//Prepare to refresh the grid_order.
			var _row = args["Row"];
			grid_order.attachData("customer_selected",1);
			grid_order.attachData("customerNumber",_row.getDataItem()["customerNumber"]);
			grid_order.refresh();
			grid_order.commit();
		}
	</script>
 
	<div style="margin-top:10px;font-weight:bold;">Customers:</div>
	<?php echo $grid_customer->Render();?>
	<div style="margin-top:10px;font-weight:bold;">Orders:</div>
	<?php echo $grid_order->Render();?>
 
</form>
Posted Sep 3, 2018 Kool
Anthony Amolochitis
Let me see if I know what you are trying to do.
1. Click the customer row.
2. Onclick event you want to edit all orders
I do know I use multiple tables to do something similar.
1. I have a list of files.
2. Click the file
3. Onclick file record event, put file field listing grid in edit view for field mapping.
Let us know what you are trying to do in detail. It may make it easier to help you.
Also, the people at KoolPHP have support ticket system that works great.
We'll be waiting for a response.
Take it easy :)
Posted Sep 7, 2018 Kool