on 03-19-2008 10:59 AM
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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
"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.
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
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
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.