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

value from cellselected

I have a grid with images displayed based on paths included in the datasource.  When clicking on the cell, I simply want to access the path value.  I've attempted several ways to accomplish this and found a few samples in the forums.  However, I only seem to be able to return the field name and not the associated value.  In the example below, if the second column (index 1) cell is selected, I am attempting to access the value from the hidden cell at the 0 index.

<ejs-grid id="Gridpic" allowtextwrap="true" allowSelection="true" dataSource="@ViewBag.datasourcepic" cellSelected="BigPic">
    <e-grid-selectionsettings mode="Cell"></e-grid-selectionsettings>
    <e-grid-textwrapsettings wrapmode="Header" />

        <e-grid-column field="picpath" visible="false"></e-grid-column>
        <e-grid-column template="#picTemplate"></e-grid-column>
        <e-grid-column template="<img src='${picpath1}'>"></e-grid-column>
        <e-grid-column template="<img src='${picpath2}'>"></e-grid-column>
        <e-grid-column template="<img src='${picpath3}'>"></e-grid-column>

<script type="text/x-jsrender" id="picTemplate">
    <img src="${picpath}&thumb=t" />


<script type="text/javascript">

    function BigPic(args)
        var grid = document.getElementById("Gridpic").ej2_instances[0];
        var field = grid.columns[args.cellIndex.cellIndex - 1].field;
        location.rel='nofollow' href = field;


1 Reply

PS Pavithra Subramaniyam Syncfusion Team December 23, 2019 11:51 PM

Hi Patrick, 

Greetings from Syncfusion. 

You can get the required cell data from the field name using the “args.data” value. Please refer to the below code example for more information. 

function BigPic(args) { 
  var grid = document.getElementById("Gridpic").ej2_instances[0]; 
  var field = grid.columns[args.cellIndex.cellIndex - 1].field; 
  location.rel='nofollow' href = field; 

Please get back to us if you need any further assistance on this. 

Pavithra S. 

Live Chat Icon For mobile
Up arrow icon