Row click event

Hi

I am attempting to navigate to another page on a row click event, passing the id of the record to an action
I am unable to get the javascript to trigger on a row click event
here is my view
here is my javascript
function recordClick() {
//Reidrect to another view
window.location.rel='nofollow' href = '/Home/Contact/';
}
the code was taken from an example provided by you in another thread

2 Replies

AP Alex Power October 9, 2017 12:14 PM UTC

for some reason my view didnt display 


@*<ej-grid id="Grid" allow-paging="true" allow-filtering="true" allow-grouping="true" datasource="Model" filter-settings="@(new Syncfusion.JavaScript.Models.FilterSettings() { FilterType=FilterType.Excel}) " record-click="recordClick">
    <e-columns>
        <e-column field="DateCreated" header-text="Date Created" text-align="Left" format="{0:MM/dd/yyyy}"></e-column>
        <e-column field="Name" header-text="Name " text-align="Left"></e-column>
        <e-column field="Email" header-text="Email" text-align="Left"></e-column>
        <e-column field="Telephone" header-text="Telephone" text-align="Left"></e-column>
        <e-column field="Source" header-text="Source" text-align="Left"></e-column>
        <e-column field="Status" header-text="Status" text-align="Left"></e-column>
    </e-columns>
</ej-grid>*@


VA Venkatesh Ayothi Raman Syncfusion Team October 10, 2017 08:42 AM UTC

Hi Alex, 


Thanks for contacting Syncfusion support. 

Query #1:”Record click event is not triggered” 
We were unable to reproduce the reported issue at our end and we have prepared a sample based on your code example which can be download from following link, 



In this sample, we have rendered the Grid and define the record click event in Grid as well as redirect to another view while we click a Grid row. Please refer to the above sample. 

Code example
<ej-grid id="FlatGrid" allow-paging="true"  allow-filtering="true" filter-settings="@(new Syncfusion.JavaScript.Models.FilterSettings() { FilterType=FilterType.Excel}) " record-click="recordClick"> 
. .  . 
         
        <e-columns> 
            . .  . 
 
        </e-columns> 
    </ej-grid> 
 
 
 
 
<script> 
 
    function recordClick(args) { 
 
 
        window.location.rel='nofollow' href = '/Home/Contact/'; 
    } 
</script> 


If you still face the same issue, then could you please provide following details? 
1)      Any script error thrown in console window while click a Grid record? If so, share the screenshot. 
2)      Please confirm whether record click event name is correct in event definition(record-click=”recordClick”) and function(function recordClick ).  
3)      Scenario for replication procedure. 
4)      A sample if possible or modified the given sample as issue reproducible. 

Query #2:” for some reason my view didn’t display  
 
 
Missed to refer ScriptManager:  
This issue reproduced when we missed to define”ej-script-manager  in _Layout.cshtml page, because ScriptManager is a new script resource manager that helps register JavaScript files. The ScriptManager registers only the Syncfusion.ASP.NET core component script files, otherwise then this the reported issue were not reproduced. So, could you please ensure whether you are defined that ScriptManager is _Layout.cshtml page like as follows,  

<body> 
     
    <div class="container body-content"> 
        <environment names="Development"> 
            <script src="~/lib/jquery/dist/jquery.js"></script> 
            <script src="~/lib/bootstrap/dist/js/bootstrap.js"></script> 
            . .  . 
        </environment> 
               <ej-script-manager></ej-script-manager> 
. . . 
    </div> 


This issue was reproduced also when we don’t define the necessary EJ script files and external script(jQuery, jsrender) and throws the script error in console window. Please refer to the following Help documentation for more information, 
 

Regards, 
Venkatesh Ayothiraman. 


Loader.
Up arrow icon