- Home
- Forum
- ASP.NET Core - EJ 2
- Trigger datagrid double click event
Trigger datagrid double click event
Hello,
I'm trying to programmatically fire the double click event on a datagrid for a specific row. How do I do this?
Thank you
SIGN IN To post a reply.
8 Replies
1 reply marked as answer
HM
Hingle McCringleberry
August 24, 2020 07:51 PM UTC
I figured out how to fire the double click event, but it can't reference args.rowData. How do I do this?
MS
Manivel Sellamuthu
Syncfusion Team
August 25, 2020 01:58 PM UTC
Hi Joshua,
Greetings from Syncfusion support.
Query: I figured out how to fire the double click event, but it can't reference args.rowData. How do I do this?
From your query we are unable to get your exact requirement. Could you please explain more about your query to validate further on your requirement.
Regards,
Manivel
HM
Hingle McCringleberry
August 25, 2020 02:11 PM UTC
I have a dataGrid. I programtically trigger the recordDoubleClick event. I want to then get the row field data from the args, but when I trigger the recordDoubleCLick event the args.rowData is not there, however, when I double click the grid through actual mouse clicks the rowData is there.

For example, in my dataGird I have a field named ESR_DOCS. When I programatically trigger the recordDoubleCLick event, I want that field to be available in the recordDoubleClick function.
My doubleClickFunction
function doubleClickFunction(args) {
alert(args.rowData.ESR_DOCS);
}
My trigger doubleclick function
function triggerGridDoubleClick(){
var grid = document.getElementById('Grid').ej2_instances[0];
var selIndex = [];
selIndex.push(parseInt(0));
grid.selectRows(selIndex);
grid.recordDoubleClick();
}
VS
Vignesh Sivagnanam
Syncfusion Team
August 26, 2020 03:34 PM UTC
Hi Joshua,
Thanks for the update
Before we procced to your requirement, we need to clarify some of the information. Please let us know the purpose of triggering the DataGrid Double-click event programmatically and this information helps to provide the solution earlier .
Please get back too us, if you need any further assistance.
Regards,
Vignesh Sivagnanam
HM
Hingle McCringleberry
August 26, 2020 08:27 PM UTC
Part 1. I have a data Grid. Above the data Grid is a button. The onclick event of that button opens a pop up (Pop Up 1) with a form on it. I fill out the form and save it's data to a table through SQL. I then programatically close that pop up, refresh the data source of the data grid and show the new record in the top row.
Part 2. I also have a double click function (Function 1) that gets called from the data grid's recordDoubleClick function, which opens a different pop up (Pop Up 2) with a different form on it. recordDoubleClick passes the selected/clicked row data to Function 1 and I can use that data to populate the fields on the form of Pop Up 2.
Issue: Immediately following Part 1, I programatically trigger the double click event from Part 2. When I do this, the row Data is not passed to Function 1, like it does when I actually double click the data Grid.
I'm trying to get that row data to be passed to Function 1 when I programatically trigger recordDoubleClick.
MS
Manivel Sellamuthu
Syncfusion Team
August 27, 2020 10:14 AM UTC
Hi Joshua,
Thanks for your update.
Based on your explanation we can understand that you want to get the arguments while programmatically triggering the recordDoubleClick event.
We would like to inform you that you are calling the recordDoubleClick event on you own, so it will not consider that event is triggered as it triggered for source level. Because it is calling the method bound to that event only. In this case the method will not contain the rowData.
To achieve your requirement by passing the row data as the arguments for the recordDoubleClick event. For that we have used getRowInfo and getSelectedRows method of the Grid. Please refer the below code example for more information.
|
<div>
<button onclick="triggerGridDoubleClick()">Trigger record double click</button>
<ejs-grid id="Grid" recordDoubleClick="doubleClickFunction" . . .
<e-grid-column field="CustomerID" headerText="Customer Name" width="150"></e-grid-column>
. . .
</ejs-grid>
</div>
<script>
function doubleClickFunction(args) {
alert(args.rowData.CustomerID);
}
function triggerGridDoubleClick() {
var grid = document.getElementById('Grid').ej2_instances[0];
var selIndex = [];
selIndex.push(parseInt(0));
grid.selectRows(selIndex);
// here we are getting the row information programmatically
var rowInfo = grid.getRowInfo(grid.getSelectedRows()[0]);
grid.recordDoubleClick(rowInfo);
}
</script> |
API:
Please let us know, if you need further assistance.
Regards,
Manivel
Marked as answer
HM
Hingle McCringleberry
September 2, 2020 06:18 PM UTC
This worked. Thank you very much!
MS
Manivel Sellamuthu
Syncfusion Team
September 3, 2020 05:32 AM UTC
Hi Joshua,
Thanks for your update.
We are glad that the provided solution is resolved your requirement.
Please let us know, if you need further assistance.
Regards,
Manivel
SIGN IN To post a reply.
- 8 Replies
- 3 Participants
- Marked answer
-
HM Hingle McCringleberry
- Aug 24, 2020 05:39 PM UTC
- Sep 3, 2020 05:32 AM UTC