Get KoolPHP UI with 30% OFF!

How to set on select for a detail table and how to recall the row and cell value

Scott
The documentation shows how to create a hierarchy of tables in the grid.
But how do you trigger on select for any of the detail tables?
For example I have this relationship
Customer->Department->Person
If I select a row on the Person level how do I trigger the on select and recall the row info on the Person table.
The examples given only provide a method on the grid level.
Posted Aug 6, 2015 Kool
David
Hi Scott,
Just use the same command. It should work for detail row as well:
$grid->ClientSettings->ClientEvents["OnRowSelect"] = "Handle_OnRowSelect";
<script type="text/javascript">
	function Handle_OnRowSelect(grid, argument)
	{
		var grid_row = argument["Row"]; //argument === {"Row": gridrow}
		console.log(grid_row);
	}
</script>

If you click on a detail row then grid_row will be that detail row.
Rgds,
Posted Aug 7, 2015 Kool
Scott
I'll give that a try, but what I am not seeing is... How do you know what dataset the click is coming from?
In my example we have 3 datasets, Master , Detail, and Detail of the Detail.
Posted Aug 7, 2015 Kool
Scott
Ok so I dropped in the code as given.
Tweaked it a little to return an alert and the value of a cell in the row.
That all worked.
However when you set allow select on the grid all tables and subtables can be selected.
Is there a way to set which table is selectable.
And / Or how do we know which row from which table is selected.
I may want to do something on the innermost table and then something different when a row from another table is selected.
However thanks for the help, it has moved what I need to do along.
Posted Aug 7, 2015 Kool
David
Hi Scott,
If you only want some detail tables to be selectable, just remove the command:
// $grid->AllowSelecting = true;

and add this one:
$table_order_detail->AllowSelecting = true;

Regarding knowing which table the current selected row is in, we haven't had a command yet. But one quick way is to get the dom element of the row:
http://doc.koolphp.net/Controls/KoolGrid/Javascript/GridRow/index.php#getElement
Then repeat going up its parent until you get to an element with class name "kgrTableView". This element contains the tableview's id.
Rgds,
Posted Aug 11, 2015 Kool