cancel
Showing results for 
Search instead for 
Did you mean: 

How to access a webdynpro node inside flex.

Former Member
0 Kudos

Hi

I already asked this question. But let me put this again in other words. I need to pass a datagrid of flex to webdynpro and store it in an internal table so that I can bind a node to that internal table. Or I would like to access the node in flex itself and assign the datagrid to it so that it gets reflected in webdynpro.

I have the following code. You can suggest changes in this.


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" width="100%" height="100%" initialize="initApp()">
<mx:Script>
<![CDATA[
import sap.FlashIsland;
import mx.collections.ArrayCollection;
import mx.controls.Alert;
[Bindable]
public var dataSource:ArrayCollection;
[Bindable]
public var studentname:String;
[Bindable]
public var score:String;
public function initApp():void
{
FlashIsland.register(this);
}
public function sendSubmit():void
{
	FlashIsland.fireEvent(this, "newSel");
}










]]>

Thanks in advance

Regards

Prashant

Accepted Solutions (1)

Accepted Solutions (1)

saravanan_narayanan
Active Contributor
0 Kudos

Hello Prashanth,

I had the similar requirement. I did the following. but there might be other solutions

1. Created an ActionScript class with the attributes that are required for the datagrid

public class Student
{
  public var name:String;
  public var score:int;
}

2. Populated the objects from dataSource collection (passed from WDA) into internal array collection of Student

public var studentCol:ArrayCollection = new ArrayCollection();
public var student:Student;

for each(var item:Object in dataSource)
{
    student = new Student();
    student.name =   item[studentname];
    student.score  = item[score];
    studentCol.addItem(student);
}

3. binded the studentCol as dataProvider for the table and created a handler for event itemEditEnd

<mx:DataGrid id="dataGrid" dataProvider="{studentCol}" itemEditEnd="change(event)" 
editable="true" >

4. in the change handler method, read the changed value from studentCol and populated the same into the datasource collection

private function change(event:DataGridEvent):void
{
    var student:Student;
    var item:Object;

    student = studentCol.getItemAt(event.rowIndex);
    item = dataSource.getItemAt(event.rowIndex);
    item[score] = student.score;
    
}

hope this helps. If you get to know better solution pls post the same.

BR Saravanan

Former Member
0 Kudos

Hi Saravanan

Thanks for the reply and sorry for the delay in response. Your procedure worked out perfectly.

However I would like to share with you another easier method to achieve the purpose. Just make all the attributes(properties) that you have common with the flex component as editable (untick the read only check box). This would be enough to let the data propogate from flex to web dynpro.

Let me know if it is usefull.

Regards

Prashant Chauhan

Answers (0)