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
475
How to get dataKeyName in cellClicked function
posted

Hi,

In my grid, I defined data key for each row:

<ig:gridView dataSource="#{gridBean.dataSource}" dataKeyName="caseId" ... >

and cell clicked function is zap()

 <ig:gridClientEvents  cellClicked="zap"/>

In zap() function,

function zap(sender, args)
{
    if(args==null)
        return;

    var evnt = args.get_browserEvent();
    if(evnt==null || evnt.target==null)
        return;

   ...
}

How to you get data key?

thanks.

 

 

  • 1765
    Verified Answer
    posted

    Hello yzbythesea, 

    If caseId is displayed in WebGrid it’s value can be easily accessed using client event. Below is the JavaScript function. If this doesn’t meet your requirement, please let us know whether or not 'caseId' is included in <ig:column> tag to be displayed in WebGrid.

    function onCellClick(sender, args) {

                var cell = new IgGridCell(args.get_browserEvent().target);

                var rowIndex = cell.getRowIndex();

                           

                var caseId = cell.getParentRow().elm.cells[1].firstChild.textContent;

    alert(caseId);                            

    }

     

    Thank you,

    Swetha