Hi Team,
I have a requirement in which I want to hide some columns.When user double clicks on a particular row want to retrieve hidden column value and based on that I want to show another grid.
I have tried the below approach.
$("#igGrid").dblclick(function (event) { // row html element debugger var row = $(event.target).closest('tr'); var strMemberCode = row.find('td:eq(0)').text(); var strFirstName = row.find('td:eq(1)').text(); var strLastName = row.find('td:eq(4)').text(); var strSSN = row.find('td:eq(5)').text();
var gridrow = $("#singleGrid").igGrid("selectedRow"); var dataview = $(documentGridName).data('igGrid').dataSource.dataView(); var cellValue = dataview[row.index]["DocumentID"];
}
I was not able to retrieve hidden column.
Please let me know ur suggestions and reply ASAP.
Regards,
Pradeep SE
Hello Pradeep,
Thank you for posting in our community.
What I can suggest for achieving your requirement is handling double click event for igGrid rows. In this event the index of the clicked row could be retrieved. Afterwards, using this index the hidden column value could be accessed from the underlying data source via index. For example:
("#grid tr").dblclick(function (event) { var rowIndex = $(this).index(), dataSource = $("#grid").igGrid("option", "dataSource"), cellValue; //get hidden cell value cellValue = dataSource[index].ProductNumber; );
("#grid tr").dblclick(function (event) { var rowIndex = $(this).index(), dataSource = $("#grid").igGrid("option", "dataSource"), cellValue;
//get hidden cell value cellValue = dataSource[index].ProductNumber; );
I also created a small sample illustrating my suggestion for your reference. In my sample I am handling double click event for grid rows. Using the row index I am accessing hidden cell value and showing it in an alert.
Please test this sample on your side and let me know whether it helps you achieve your requirement.
Do not hesitate to contact me if you need any further assistance with this matter.
We tried the solution given above but it was not working as expected. We are using Infragistics version 15.2.The particular row click event (("#grid tr").dblclick) was not supported and then we are using grid with pagination so that if we take the index of datatsource this will not be working as we expect. Please provide the solution for this ASAP.
Pradeep SE.
When Paging feature is enabled calculations should be made in order to retrieve the index in the underlying data source. Current page index should be multiplied to the page size and current row index should be added in order to get the index of the record in the underlying data source. For example:
$("#grid").dblclick(function (event) { // row html element var row = $(event.target).closest('tr'), rowIndex = row.index(), dataSource = $("#grid").igGrid("option", "dataSource"), pageIndex = $("#grid").igGridPaging("option", "currentPageIndex"), pageSize = $("#grid").igGridPaging("option", "pageSize"), cellvalue; if(pageIndex === 0){ cellValue = dataSource[rowIndex].ProductNumber; } else{ //in order to get index in data source, whne Paging is enabled, pageIndex is multiplied to page size and current index is added cellValue = dataSource[pageIndex*pageSize + rowIndex].ProductNumber; } alert(cellValue); });
I am also attaching my modified sample which uses version 15.2 of Ignite UI controls.
Please have a look at this sample and let me know if you need any further assistance with this matter.