Hi Ian,
Thanks for using Syncfusion products.
Query: Is there a way to automatically expand the DetailsTemplate on a grid when a row is selected rather than having the user click on the expand icon?
We suggest you to use RowSelected client side event and expand the details template by using expandCollapse function of Grid object. We can reselect the expanded details row to collapse it based on its e-detailrowcollapse class name. Please refer the below code snippet for further details.
@(Html.EJ().Grid<RowSelectedDetailsExpand.OrdersView>("DetailsGrid") ------- ------- .ClientSideEvents(eve => { eve.DetailsDataBound("detailGridData").RowSelected("onRowSelected"); }) )
<script type="text/javascript"> function onRowSelected(args) { if (args.row.find(".e-detailrowcollapse").length != 0) this.expandCollapse(args.row.find(".e-detailrowcollapse")); else this.expandCollapse(args.row.find(".e-detailrowexpand")); } </script> |
For your convenience we have created a simple sample and the same can be downloaded from the below link.
Sample Link: http://www.syncfusion.com/downloads/support/forum/118534/RowSelectedDetailsExpand115865716.zip
Please let us know if you have any concerns.
Regards,
Ajith R