Is there any event to capture the row double click event? And i need how to read an item in the selected row and pass it as a query string to some other page. I need sample in ASP.NET MVC Razor (cshtml). It will be great if some one can assist me on the same.
Hello Suresh A,
Currently igGrid doesn't support row double click event out of the box. As a workaround you can use jQuery dblclick function and bind to igGrid directly to listen for double click events.
Your code should look like this:
$("#grid1").dblclick(function (event) {
// row html element
var row = $(event.target).closest('tr');
// data key value
var key = row.attr("data-id");
// cell values
var cellZeroValue = row.find('td:eq(0)').text();
var cellOneValue = row.find('td:eq(1)').text();
var cellTwoValue = row.find('td:eq(2)').text();
// get the next cell value by changing eq index argument. For example :eq(3) will return four element
}
);
igGrid MVC wrapper obviously doesn't have row double click event functionality also. You can use it to create the grid, but you have to put JavaScript code as the code above to listen for double click events.
You can find good examples on how to create igGrid in Razor code in our samples site:
https://www.igniteui.com/grid/overview
You can also want to look at this forum post:
https://www.infragistics.com/community/forums/f/ignite-ui-for-javascript/59503/get-value-from-selected-row-on-double-click
Hope this helps,
Martin Pavlov
Infragistics
Hello Martin,
Thanks a lot. I will try it out and will update you.
Regards,
Suresh A
Hi Martin,
The code is working but on double click it is very very slow to open a popup window. In my case i have around 500+ records in the grid. Let me know is there any better way to do the same.
I did create test bed with igGrid(with no features enabled) holding more than 500 rows (JavaScript array) and the double click function works perfect for me. I'm missing something so can you answer me some questions:
1. What features do you use in igGrid?
2. Which browser are you using in your tests? What version?
3. Can you confirm that the bottleneck is in getting the row or cell values from the grid in the double click function?
4. Can you confirm that the bottleneck in not in opening the popup window?
Thanks in advice,
Infragistics, Inc.
Kindly find below the answers for your question
features.Selection().MouseDragSelect(true).MultipleSelection(false).Mode(SelectionMode.Row);
IE 8
Row value. I have followed your code.
When i give window.location = address it is opening fine but when i give window.open(address) then it is taking a lot of time. Let me know is there any other way to open the popup window.
My requirement is as below
I have a grid when i double click a row it has to open a popup window which wll have options to modify certain details. After the modification the popup needs to be closed and the grid needs to be refreshed with the modify values.
Let me know how can i acheive the same.
Any update on this???
Hello Suresh,
Thank you for posting in our forums.
I created a support ticket on your behalf
CAS-82287-FDBWKR
You can upload your sample code to the case
as we are not able to reproduce the issue in our environment
using the appoach which Martin provided you.
Please zip all the files before attaching them to the case.
Hope hearing from you.
Hi Tsvetelina Georgieva,
Thanks for your response. As mentioned earlier when i use window.open its getting some time to load the page where as if i give window.address its opening fine.
My issue is
<script type = "text/javascript" > $(document).ready(function () { $('#igGrid1').delegate('.ui-iggrid-activerow', 'dblclick', function (e) { var row = $('#igGrid1').igGridSelection('selectedRow'); var dataview = $('#igGrid1').data('igGrid').dataSource.dataView(); var cellValue = dataview[row.index]["UserId"]; var address = "@Url.Action("ModifyUser")" + "?UserId=" + cellValue; window.location = address; }); }) </script>
The above script works perfectly fine when i double click on the grid which is in the users.cshtml page.
I have 2 pages
1. Users.cshtml - Displays the user details int he grid. When i double click i need to
open a modal popup window where i will pass user id as a query string to modifyusers.cshtml page
2. ModifyUsers.cshtml - User is allowed to modify certain details on the page. On click of save button
it is updating the details to the DB. After it gets updated the popup needs to be closed and
the grid in users.cshtml must be refreshed.
How to acheive the same?
Any updates on this?