cancel
Showing results for 
Search instead for 
Did you mean: 

Fetch the Values of Cell from i5Grid using cellSelectionEvent ?

Former Member
0 Kudos

I'm trying to fetch the value of the cell on selection using cellSelectionEvent of i5Grid. I have registered my event handler for the cellSelection event and the event handler gets executed whenever any cell in the i5Grid is selected. But i don't find any methods that would fetch me the value of the selected cell in the i5Grid.

As per UI5 conventions, we usually pass an parameter  say oEvent to the event handler which would contain the value of the selected cell, but it seems that's not the case with MII i5Grid as the parameter oEvent returns undefined. So what is the way out here to fetch the value of the selected cell ?


i5Grid.registerCellSelectionEvent(function(oEvent){

     alert("cell selection event");

     console.log(oEvent); // undefined;

});

- Sakthivel

Accepted Solutions (0)

Answers (1)

Answers (1)

Private_Member_14935
Active Participant
0 Kudos

Hi Sakthivel,

You can try the following:

   

i5Grid.registerCellSelectionEventHandler(function(oEvent){

     alert("cell selection event");

     console.log(oEvent); // Q.Event

     alert("selected cell value is "+Grid.getSelectedCellValue()); //This returns the value in the selected cell

});

Please mention the version of MII that you are using.

Thanks and Best Regards,

Ria

Former Member
0 Kudos

The version we're using is 15.0 SP4 patch1. The UI5 version is - 1.22.2

There isn't a method  getSelectedCellValue on the i5Grid instance that i have created. And also the oEvent is undefined as no arguments are passed to function listener. So, i suspect that these methods ain't available with the version we're using ? Can you let us know the version that you're using ? Or has it got anything to do with the way the i5Grid instance is created ? Is there any specific properties required to be enabled in the i5Grid constructor ?

Update : I was able to find the doc listing out all the methods where getSelectedCellValue() has also been listed,

iGrid Component Methods - SAP MII Workbench - SAP Library

But this comes under iGrid methods whereas the control that am using is i5Grid. Are they both the same or different ones ?

- Sakthivel

Private_Member_14935
Active Participant
0 Kudos

Hi Sakthivel,

The method on i5Grid component in 15.0 SP expects the column index and appears to be buggy (I tried with 15.0 SP4 P10) -- doesn't work on first selection and from the next selection onwards return old selection value.

alert(grid.getGridObject().getSelectedCellValue(grid.getGridObject().getSelectedColumnIndex()));

The snippet I have mentioned in the previous reply works on 15.1 SP (yet to be in GA).

Thanks and Best Regards,

Ria