cancel
Showing results for 
Search instead for 
Did you mean: 

Putting data into table rows...

Former Member
0 Kudos

Hi, I have read some of the old posts but they dont give me an answer. I have 3 column and 20 rows table. I want to fill first 4 rows with data, Ill write it from keyboard, it does not have to come from any of inputfields or whatever, I just need to put there some words for now and thats it. How can I do that? Regards, Blamer.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

1)u can create a valuenode(address)

2)Under this valuenode u can create 3 attributes like(state,city,street)

3)Now u can create a table ui element and bind the datasource property of table to the Address valuenode

4)Then u can write the following code in the init method

wdContext.nodeAddress().invalidate();

IPrivateView1.IAddressNode node1=wdContext.nodeAddress();

IPrivateView1.IAddressElement ele;

ele=node1.createAddressElement();

ele.setState("AP");

ele.setCity("NLR");

ele.setStreet("NGOColony");

node1.addElement(ele);

where View1 is the viewname.

like the avove u can add 20 rows with diff values

Answers (3)

Answers (3)

Former Member
0 Kudos

hi,

Say if your table element is binded to the node EmpNode with 2 attributes EmpName and EmpRoll, then to get each cell you apply the following code:

for(int i=0;i<wdContext.nodeEmpNode().size();i++)

{

//getting the row accordin to the size

IEmpNodeElement element =

wdContext.nodeEmpNode().getEmpNodeElementAt(i);

if(i==3)

{

element.setEmpname(wdcontext.currentEmpNodeElement.getInputName());

}

Create a method called "click". Assign it to the tableUI.Add the code to the onActionClick().

Suppose you have created one input field called InputName();

Put the value there from the keyboard and click enter, it will be populated

}

Former Member
0 Kudos

Thanks guys for such a great response. Im trying your ways without succes yet, still got some code errors in any of your codes. Ctrl+space didnt help. Ill try to figure it out what do I do wrong. Regards, Balmer.

Former Member
0 Kudos

Create a new Table UI Element and Try Balmer.

If any problem means feel free to ask

Best Wishes

Idhaya R

former_member197348
Active Contributor
0 Kudos

Hi Balmer,

First you need to create context node and table with InputFields . After creating required Value node (say <tablenode>) and attributes ( ID, Name and Date in your case ) in the context follow this steps:

1.Create table in the layout.

2.Right click on table -> Select Create Binding

3. In the wizard select the node -> Next

4. Click on the third column Editor for each row -> Drop Down appears -> Change to Input field (Like this you can select the table cellEditor whichever suits your requirement)

5. Click Finish

6. Go to Implementation -> wdDoInit():

Write this Code

// you can set the size to how many empty rows you want
int size = 4;
for(int i=0;i<size ; i++) 
{
IPrivate<Viewname>.I<tablenode>Node node =  
wdContext.node<tablenode>();
IPrivate<Viewname>.I<tablenode>Element elm 
= wdContext.create<tablenode>Element();
node.addElement(elm);
}

regards,

SIVA

Edited by: Siva Rama Krushna on Mar 19, 2008 5:19 PM

Former Member
0 Kudos

hai balmer,

set the enable property of the tablecell editor by binding it to a boolean context attribute and use a for loop for 1st four rows and set it to true.Any issues let me know.

Thanks n Regards

Sharanya.R

Former Member
0 Kudos

Hi, dont have much of an idea what you just told to me :). I have binded ValueNode -> Value Arributes of ID, Name and Date, then those binded to TextView in each column. What do I do from this part? Thanks, Balmer.

Former Member
0 Kudos

Hi Balmer,

Lets say you have created a value node of Name "Table" and created three value attributes under it say Val1,Val2,Val3. Create one more value attribute 'Enable' of type boolean under the node Table.

Create a Table UI Element in the view. Right click on Table and choose Create binding . Choose the value node "Table" and uncheck the value attribute "Enable" . Then choose Next. In the Editor column choose InputField from the dropdown. Click on Finish.

Now write this code in wdDoInit() method of the view

for(i=0;i<20;i++)

{

if(i<3)

{ wdContext.currentContextElement().setEnable(true); }

else

{ wdContext.currentContextElement().setEnable(false); }

}

Now Go to the Layout tab and choose the InputField Under the column . Set the property of the Input Field to Enable (Value Attribute under the node Table).

If you have any queries revert back

Best Wishes

Idhaya R

Former Member
0 Kudos

"Lets say you have created a value node of Name "Table" and created three value attributes under it say Val1,Val2,Val3. Create one more value attribute 'Enable' of type boolean under the node Table.

Create a Table UI Element in the view. Right click on Table and choose Create binding . Choose the value node "Table" and uncheck the value attribute "Enable" . Then choose Next. In the Editor column choose InputField from the dropdown. Click on Finish.

Now write this code in wdDoInit() method of the view

for(i=0;i<20;i++)

{

if(i<3)

{ wdContext.currentContextElement().setEnable(true); }

else

{ wdContext.currentContextElement().setEnable(false); }

}

Now Go to the Layout tab and choose the InputField Under the column . Set the property of the Input Field to Enable (Value Attribute under the node Table).

"

Hi, thanks for answer, I did as you told. Once I made bindings my table tripled it self. Now I have

ID==Name==Date====ID_0==Name_0==Date_0===ID==Name==Date. I have made inputfield and binded to it enable context of type boolean. Code didnt provide any errors however no changes were done to table. Still empty. Thanks, Balmer.

Former Member
0 Kudos

Put this code and try yar.

for(i=0;i<20;i++)

{

IPrivate<viewname>.ITableNodeElement Ele = wdContext.createTableNodeElement();

wdContext.nodeTableNode().addElement(Ele);

if(i<3)

{ Ele.setEnable(true);}

else

{ Ele.setEnable(false); }

}

Former Member
0 Kudos

Thanks for answer, I have made it that way:


IPrivateTabView.ITabNodeElement elem;

		  int count = 10;

		 for(int i=0; i<count; i++) {

			 elem = wdContext.nodeTabNode().createTabNodeElement();

			 wdContext.nodeTabNode().addElement(elem);

			 elem.setCol1("column1data" );
			 elem.setCol2("column2data" );
			 elem.setCol3("column3data" );

			 elem.setSelectedCellVariant("variant1");

and it works correctly, it projects same data 10 times. Now if I set count = 1; I get one row with data like above. Now I want to make second row with other kind of data. How can I do that? Regards, Balmer

former_member197348
Active Contributor
0 Kudos

Hi Balmer,

If you want to add different rows with different kinds of data, you can do like this:

1.Without loop:

//first element
IPrivateTabView.ITabNodeElement   elem1 = 
wdContext.nodeTabNode().createTabNodeElement();
elem1.setCol1("column1data1" );
 elem1.setCol2("column2data1" );
 elem1.setCol3("column3data1" );
 elem1.setSelectedCellVariant("variant1");
 wdContext.nodeTabNode().addElement(elem1);
//second element
IPrivateTabView.ITabNodeElement   elem2 = 
wdContext.nodeTabNode().createTabNodeElement();
elem2.setCol1("column1data2" );
 elem2.setCol2("column2data2" );
 elem2.setCol3("column3data2" );
 elem2.setSelectedCellVariant("variant2");
 wdContext.nodeTabNode().addElement(elem2);
// like this you can add different elements

2.With loop:

IPrivateTabView.ITabNodeElement elem;
  int count = 10;
for(int i=0; i<count; i++) {
elem = wdContext.nodeTabNode().createTabNodeElement();
 wdContext.nodeTabNode().addElement(elem);
if(i==0)
{
elem.setCol1("column1data" );
 elem.setCol2("column2data" );
 elem.setCol3("column3data" );
 elem.setSelectedCellVariant("variant1");
}
if(i==1)
{
elem.setCol1("column1data2" );
 elem.setCol2("column2data2" );
 elem.setCol3("column3data2" );
 elem.setSelectedCellVariant("variant2");
}
//like this you can set different elements
}

regards,

Siva