on 05-14-2007 7:25 PM
Hi,all
I need step by step algorithm for creating dynamic table from two
another tables (the rows of the new table will be created from two tables
which I create in design time).
Regards,
Michael
If you mean you need steps for creating the table UI control dynamically, there are tons of examples in this forum, like this:
If you mean you need steps for filling the table with data dynamically (filling the context node the table is bound to from two other context nodes), try something like this:
source nodes A and B (each with attribute "text")
target node C (with attribute "text")
for (int i = wdContext.nodeA().size(); i++)
{
IPrivateYourViewName.ICElement elem = wdContext.nodeC().createCElement();
wdContext.nodeC().addElement(elem);
elem.setText(wdContext.nodeA().getAElementAt(i).getText());
}
for (int i = wdContext.nodeB().size(); i++)
{
IPrivateYourViewName.ICElement elem = wdContext.nodeC().createCElement();
wdContext.nodeC().addElement(elem);
elem.setText(wdContext.nodeB().getBElementAt(i).getText());
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
solved by myself
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
How many columns are present in Student and Course Tables
In your 3 rd table How many columns you required.I mean you have student details in one table and course details in one table am i right.So your third table consists of Student Details and Course details selected ones .
regards
kalyan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Michael,
Frankly, you under-estimate complexity of this task.
Here is an outline of what you have to do:
1. Create new context node that contains necessary attributes from students and N necessary attributes per each Course selected.
2. Assign IWDNodeCollectionSupplier that populates new node elements as a join of nodes Students / Courses (sure, with Courses filtering).
3. Remove all columns in table, iterate over attributes of IWDNodeInfo of node created in [ 1 ] and add necessary columns with cell editors.
- On every selection change (checkboxes for Courses) you have to repeate steps 1..3. Same for adding/removing/reordering of Courses elements.
- For any changes of elements in Students you need to invalidate node created in [1] so suply function defined in [2] is called.
Valery Silaev
SaM Solutions
Michael,
Do you plan to use single view for Courses selection and dynamic table or separate views? The answer depends on this...
Valery Silaev
SaM Solutions
Michael,
Then you have to place in Toggle action handler the code that does [ 1 ] -- creating dynamic node. Btw, don't forget to call wdContext.getContext().reset( false ) here to remove any previouslyu created dynamic node if any.
Also in Toggle action handler should be code that assigns supplier for node or populate dynamic node (step [ 2 ]). Plus, it's necessary to set some context attribute that dynamic node was changed.
In wdDoModify view you must check this context attribute (flag), if it is set then you have to remove all table columns and create new ones. Sure, you must reset flag here afterwards.
Valery Silaev
SaM Solutions
Hi,Valery
I'm really confused in my requiment.I need your help!
From the beginning,
I have two tables which I created in design time,one of the columns in
each table is the column with cell editor CheckBox.Two tables are populated
by members in DoInit() function.The third table,that I create dynamicly is
populated by members from two first tables,but only by rows which were selected
by user(user select rows in two tables by checking checkboxes and press button
"create new table").I also created value attribute of type boolean which I set to true
in my onActionCreateTable() and ask in wdDoModifyView if it is set to true.How can I destroy the first dinamicly created table if I want to change it's members?
There are your 2 and 3 steps..
Regards,
Michael
Hi
These are the steps
1.You have the dataSource nodes of the 2 tables which you created.
2.Find when you have to display the dynamic table.
3.On that condition in wdModify method create a table and a valuenode there and bind this to the dataSource property of the table created dynamically
Make cardinality properties are correct.Add the table to the rootcontainer.
4.In that condition where you want to display the dynamic table,Add the elements that means rows fetched from the 2 design tables(elements of dataSources of designtime tables)
5.Before filling that check the valueNodes binded to the 2 design tables are not empty.
6.While fetching the elements of the valueNodes of 2 designTime tables clearly mention the condition in coding.
7.Dont forget that you can only create a table in wdModify method using view reference.
Hope that it will help to solve ur problem.
regards
kalyan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Michael,
Can you please eloborate on your requirement.
I mean flow of your process. when the third table should be shown, when the data in the third tbale should be added from other two table ?
Is their any action involved ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,Shriram
I have 2 tables:
1)students
2)courses
In both tables I have the check boxes in every row
The third table is created from rows which were checked
in two initial tables.The number of rows in third table will be
the number of rows in table students,
and the number of columns in the third table will be the
number of rows in table courses.
Regards,
Michael
Hi Michael,
i am still confused with your idea of having the rows of courses table as columns in the third table.
For each student selected from the student table what is that you want to display from courses table.
can you be bit detailed ?
Suppose i select two rows from student table and five rows from courses table, than will their be two rows and five columns in the third table with the selected courses names as column name in the third table.And what about student values from student table ?
I dont know if was able to explain you my concern but i am blank with your requirement
User | Count |
---|---|
94 | |
11 | |
11 | |
10 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.