on 04-07-2006 1:57 PM
Hi
I have an application, which has a drop down in the table. Each row is to have different values in its drop down based on the "characteristic" parameter. For eg. first row has characteristic as color, and the corresponding drop down will contain the color names. Second row has charateristic as weight, and the drop down will carry corresponding weight values.
I am getting the data from the backend as a flat table i.e. charaterisitc - value pair.
I think i will have to use the Drop Down by Index control, but i dont know how exactly to go about it.
Can any one please help in this regard.
Thanks & regards,
Anupreet
Hi Anupreet,
Right, you should use drop down by index. Create context node under your datasource node with appropriate attributes and make it singleton false and cardinality 0..n. Add column to table. Insert cell editor as drop down by index and bind attribute from new created node to appropriate property from drop down.
Best regards, Maksim Rashchynski.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
I did exactly as per what you said, but now, it shows all the values in the first row's drop down (including the entries for the second row drop down). And second row's drop down is coming as blank. Is any code to be written further for this whcih will be executed at runtime?
The first column, based on which drop down values are to be displayed is not a drop down. It contains a single value only each row, like a normal cell data.
Thanks & regards,
Anupreet
Hi Anupreet,
When you are populating node with data fro drop down you should not use current<dataSourceNode>Element but for every node element.
IWDNode node = wdContext.nodeDisplayTable();
final int size = node.size();
for (int i = 0; i< size; i++)
{
final IWDNodeElement _element = node.getElementAt( i );
...
}
Best regards, Maksim Rashchynski.
Hi Maksim
I am sorry, but i am not able to get you.
This is the piece of code that i wrote for populating the drop down:
IPrivateMaintainDocAttribView.IDropElement dropEle = null;
for(int i = 0;i<size;i++)
{
dropEle = wdContext.nodeDrop().createDropElement();
dropEle.setDropval(wdContext.nodeCtxNode_DocAttribs().getCtxNode_DocAttribsElementAt(i).getCmpCtx_Value());
wdContext.nodeDrop().addElement(dropEle);
}
Here, Dropis the sub node to which i am putting the data and thisis linked to the table.
CtxNode_DocAttribs is the model node from where i am picking the data and setting in the subnode.
Thanks & regards,
Anupreet
Hi Anupreet,
Try this
IPrivateResult.ICtxNode_DocAttribsNode node = wdContext.nodeCtxNode_DocAttribs();
int size = node.size();
IPrivateResult.INodeDropElement dropEle;
for(int i =0;i<size;i++) {//for every element in CtxNode_DocAttribs node
IPrivateResult.INodeDropNode subnode = node.getCtxNode_DocAttribsElementAt(i).nodeNodeDrop();
for(...) {//for every item in drop down
dropEle = subnode.createNodeDropElement();
dropEle.setDropval( ... );
subnode.addElement(dropEle);
}
}
Hi Maksim
I tried the code provided by you. But it shows multiple rows and each row's drop down contains all the values besides, one blank element is added to the list with each iteration. Foreg. if my table contains 2 rows, the drop-down column shows 6 rows carrying the drop downs, and each one is having all the values plus one blank element added for each one of them additionally. Even though the first column shows data in only 2 rows as it is supposed to display.
Thanks & regards,
Anupreet
Anupreet,
1. Use drop-down by index
2. For this UI control create child node of cardinality 0..n, singleton=false right under node that is used as table data source.
VS
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.