Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
285
cellClick event returning wrong colKey
posted

I have a fairly simple Hierarchical Grid, just two levels.  Companies at the top level, and employees when you drill down.  Both levels have three columns: an icon,  description, and ID (not visible).  Users should be able to click on any cell to open more details about that item.  I'm using the cellClick event to detect the user's request.  For the top level, it works fine.  When I click on a field in the second level, I'm having issues.  

* ui.colKey is showing a column from the top level.  Depending on which cell I click on, the colKey changes, appearing to is the correct column index, but just choosing from the wrong level.  Clicking an employee's name gives me the colKey=CompanyName.  So if I click on column 0 in level 1, I get column 0 in level 0.  If I click on column 1 in level 1 I get column 1 in level 0.

I noticed that this sounds very similar to a bugfix in IgniteUI_Release_Notes_13.1.20131.2143_EN.pdf.  That bug referred to looking at colKey in the cellClick event for a hierarchical grid.  I am using that version (13.1.20131.2143).  

Thank you,

Brad.Larsen@StratisInc.com

Parents
  • 18204
    Verified Answer
    Offline posted

    Hi Brad Larsen,

    When using the igHierarchicalGrid, the events and features should be defined for each layout for more granularity in control.  Please see the code snippet below for an example:

     $("#grid1").igHierarchicalGrid({
        primaryKey: "CompanyID",
        columnLayouts: [
            {
                name: "Employees",
                primaryKey: "EmployeeID",
                ...
                cellClick: function(evt, ui) {
                    //  Inside child grid
                }
            }
        ],
        ...
        cellClick: function(evt, ui) {
            //  Inside parent grid
        }
    });

    When clicking in the child grid, if you do not want the event to fire for the parent grid, you should call evt.stopPropagation() in the child grid's event handler.

    I have attached a sample for you to examine that demonstrates how to do this.

    If you have any further questions, please let me know and I will be glad to help.

    igHierarchicalGrid - CellClick colKey.zip
Reply Children
No Data