We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Show DetailsTemplate on row selection

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?

Thanks

3 Replies

AR Ajith R Syncfusion Team March 18, 2015 06:23 AM UTC

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



IH Ian Hicks March 18, 2015 10:04 AM UTC

Hi Ajith,
That's great, many thanks for your help.


AR Ajith R Syncfusion Team March 19, 2015 09:45 AM UTC

Hi Ian,

Thanks for your update.

We are happy to hear that your requirement has been achieved in your end.

Please get back to us if you have any other concerns.

Regards,

Ajith R


Loader.
Live Chat Icon For mobile
Up arrow icon