on 07-25-2014 10:48 AM
Hi Friends,
Can anyone help to how to find the selected Row/Cell value of a i5Grid object. I am able to register the event handlers which are getting invoked on row/cell selection. But I want to know how can I get the value of selected Cell/Row. I would like to add selected Items from one i5Grid to another one.
So want to know how can I get and set the value of i5Grid object.
MII version 14.0 SP4 Patch
Thank in advance
Shaji Chandran
Hi Shaji,
you can use the following JS functions which are available in Script Assistant.
.
In the following Format.. in Java script
Grid.getGridObject().getSelectedCellColumn()
Grid.getGridObject().getSelectedCellRow()
...
you can get selected Cell value like this.
var col_no=Grid.getGridObject().getSelectedCellColumn(); |
alert(Grid.getGridObject().getSelectedCellValue(col_no));
Regards,
Sriram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Shaji,
You can find all the getter and setter methods for i5Grid here:
i5Grid Object Methods - i5Grid - SAP Library
Regards,
Rohit Negi.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Shaji,
Here is my code.
-----------------------------------
<!DOCTYPE HTML>
<HTML>
<HEAD>
<TITLE>Your Title Here</TITLE>
<META http-equiv="X-UA-Compatible" content="IE=edge">
<META http-equiv='cache-control' content='no-cache'>
<META http-equiv='expires' content='0'>
<META http-equiv='pragma' content='no-cache'>
<SCRIPT type="text/javascript" src="/XMII/JavaScript/bootstrap.js" data-libs="i5Chart,i5Grid,i5SPCChart"></SCRIPT>
<SCRIPT>
var Grid = new com.sap.xmii.grid.init.i5Grid("STC/C5167365/i5Grid_TagQuery", "STC/C5167365/TagQuery");
Grid.setGridWidth("640px");
Grid.setGridHeight("400px");
Grid.draw("div1");
function setCellValue()
{
Grid.getGridObject().setCellValue(1,1,"Set");
}
function setCellValueAgain()
{
Grid.getGridObject().setCellValue(1,1,"Changed Again");
}
</SCRIPT>
</HEAD>
<BODY>
<DIV id="div1"></DIV>
<INPUT type="Button" value="setCellValue" onClick="setCellValue()"/>
<INPUT type="Button" value="setCellValueAgain" onClick="setCellValueAgain()"/>
</BODY>
</HTML>
-------------------------
Regards,
Sriram
Sriram,
Thanks for sharing the code. Here you are changing the value of same cell again. Let me explain my scenario. I have got 2 i5Grid objects and want to add the items from object to another.
I will select an item from the one grid and want to add the same item to other grid at onlick event of a button (Add button).
What happens for me is that, it will add only for the first time. Second time when I select an item and follow the same process (click on add button) it doesn't add.
Any help on this very much appreciated
Thanks
Shaji
Hi Shaji,
While adding the Selected Item to second grid, Make sure that row index should be incremented before using the method
setCellValue(int,int,string)
while adding a new item, or else it will simply over write the existing one.
I tried the scenario which you told . Is it the below one which you were asking about ?
Regards,
Sriram
Sriram,
Thanks for you effort again.
Yes I am taking care of rowIndex. I just tried to hard code some values to add the grid. The below code is only adding first item to the grid.
selectedTagListGridObj.setCellValue(1,1,"one"); --> This line works as expected
selectedTagListGridObj.setCellValue(2,1,"two");
selectedTagListGridObj.setCellValue(3,1,"three");
Thanks
Shaji
User | Count |
---|---|
9 | |
7 | |
3 | |
2 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.