cancel
Showing results for 
Search instead for 
Did you mean: 

How to add data in table dynamically?

Former Member
0 Kudos

Hi,

I created Tabstrip and table for first tab dynamically. I want to display this table data for second tab dynamically.

1) How to enter data data in the table.

2) How to add view to the tab.

3) Whenever i click the checkboxes in table , corresponding tab will be visible in view. How it is?

            • These all are dynamically only.

Plz help me, it's very urgent.

Thanks

KSR

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

1) How to enter data data in the table.

Create an element of the node bound to the table or to make it editable initially set the* cardinality of the node bound to 1..n*

2) How to add view to the tab.

You can use viewcontainer UI element to add views to a tab. Place this control in the tab and from window embed the view want.

3) Whenever i click the checkboxes in table , corresponding tab will be visible in view. How it is?

Create a context attribute and bind this to the selectedTab property of the tab and set the ID of the tab to be selected.

Regards

Ayyapparaj

Answers (2)

Answers (2)

former_member485701
Active Participant
0 Kudos

Hi,

In following manner you can create a dynamic node and bind to a dynamically created table

(1)You can create a Node dynamically for Table (data source binding)

IWDNodeInfo tableNodeInfo = wdContext.getNodeInfo().addChild("TABLE_ID", null,true, CMICardinality.MANY,CMICardinality.MANY, true, null);

(2) In Next Step add the attributes in following manner.

IWDAttributInfo attr=tableNodeInfo.addAttribute("att1","com.sap.dictionary.string");

(a)In wdDoModify method create your table dynamically

IWDTable table=(IWDTable)view.createElement(IWDTable.class,"DetailTable");

Binding table with the data source

table.bindDataSource(tableNodeInfo.getName());

(b)Creating Column and cellEditor

IWDTableColumn tableColumn =(IWDTableColumn)view.createElement(IWDTableColumn.class,"tableColumn");

IWDCaption tableHeaderCaption = (IWDCaption)view.createElement(IWDCaption.class,"tableHeaderCaption");

IWDInputField tableCellInputField= (IWDInputField) view.createElement(IWDInputField.class,"tableCellInputField");

(c)binding inputfield value

tableCellInputField.bindValue(tableNodeInfo.getName()"."attr.getName());

REgards,

Praveen

suresh_krishnamoorthy
Active Contributor
0 Kudos

Hi KSR,

Dont add view to the tab. Create one View in that create tabstrip UI element add your specific table to the corresponding tabstrip content area. so that you easily toggle between the tab using action button.

Code snippet for changing tab view:

wdContext.currentContextElement().setSelectedTab("Tab1");

Dynamic table creation code snippet you can find here(SDN).

Let me know if you need more details.

Regards, Suresh KB

Former Member
0 Kudos

Hi,

thanks suresh for ur reply.

But i did't get in SDN, the data creation in table dynamically.

How to add specific table to the corresponding tabstrip content area. How to toggle between the tab using action button.

I am not aware of this dynamically.

Plz help me.It's very urgent.

thanks

KSR

suresh_krishnamoorthy
Active Contributor
0 Kudos

Hi KSR,

As per your requirements I can see you want to show data dynamically between two tabs according to checkbox action. In this case I would suggest you to create tabstrib using UI element under the content area you create required UI elements rather than adding(embeding) view to the tabstrip.

Dynamic table sample code: [Here|;

Regards, Suresh KB