Hi all,
I have a Problem when using the cellClick Event and the groupBy Feature.
using the following colums:
columns: [ { key: 'id', headerText: 'Id', width: '20%', dataType: 'number' }, { key: 'projectNo', headerText:'Projektnr',dataType:'string', width:'20%', formatter:formatNameColumn,unbound:true}, { key: 'name', headerText: 'Projekt', width: '20%', dataType: 'string'}, { key: 'description', headerText:'Projektbeschreibung',width: '20%',dataType:'string'}, { key: 'customer', headerText:'Kunde', width:'20%',dataType:'string'}, { key: 'company', headerText:'Firma', width:'20%',dataType:'string'}
I get projectNo when I click in a cell of the projectNo column.
If I Group the grid by any other column, now I get name as the colKey in the cellClick Event, which is the key of the following column. It seems that the cellGrid Event doesn't work correctly.
Best regards
Andreas
Hallo,
I also think that this is a bug. cellClick event handler gets the "ui" parameter with wrong "ui.cellKey" value. This needs to be fixed.
Please be so kind and evaluate this again and create an internal bug ticket. :)
kind regards.
Hello abuerstner,
Thank you for your feedback. We are constantly trying to improve our products and we appreciate that you took time to convey your comments. I assure you that we consider our customer feedback to be crucial for steering improvements at Infragistics. Your comments will be forwarded to the appropriate management for review and consideration.
Thank you for using Infragistics components.
Hello Vasya,
thanks for your reply. That the colindex changes when grouping by a column, makes sense, that is the reason why I am used the colKey instead of using the index, but from my point of view it is a bug, that the key of a column changes by grouping, what should i do, when i additional allow a user to change the column order, it will be nearly unpossible, to find out, what column the is clicked.
For my scenario, I can use your workaround, but I think this should be changed i a further version.
Thank you for posting in our community.
When the data in the igGrid is grouped by a particular column, column indexes are changed since there is an additional column added for expanding/collapsing groups. This means that grid columns start from index 1 instead of 0 after grouping. This is the reason why a difference appears when there is a grouped column, compared to when there is no grouped column - the index for the same column is different. For example, when columns are not grouped the index of the ID column is going to be 0, but when grouping is used it is going to be 1. What I can suggest in this case is checking whether there is a grouped column before retrieving the column key. This could be a global variable, which will be available in the cell click event. This variable is going to be updated every time when the grouped columns are changed (in the groupedColumnsChanged event).For example:
{ name: "GroupBy", type: "local", groupedColumnsChanged: function (evt, ui) { groupedColumns = ui.owner.options.groupedColumns.length; } cellClick: function (evt, ui) { if (groupedColumns > 0) { var colIndex = ui.colIndex; var colKey = $("#grid").igGrid("option", "columns")[colIndex - 1].key; alert("You just clicked on column with key: " + colKey); } else { alert("You just clicked on column with key: " + ui.colKey); } }
{
name: "GroupBy",
type: "local",
groupedColumnsChanged: function (evt, ui) {
groupedColumns = ui.owner.options.groupedColumns.length;
}
cellClick: function (evt, ui) {
if (groupedColumns > 0)
var colIndex = ui.colIndex;
var colKey = $("#grid").igGrid("option", "columns")[colIndex - 1].key;
alert("You just clicked on column with key: " + colKey);
else
alert("You just clicked on column with key: " + ui.colKey);
Additionally, I made a small sample project illustrating my suggestion and I am attaching it for your reference.
Please let me know if you have any further questions regarding this matter