on 02-15-2010 12:40 PM
Hi All,
I have a requirement to display a table with a dropdown, wherein the selection values is based on the entry in the current row. Let me explain the scenario:
I have a table containing 3 columns (Material ID, Material Description and WorkCenter). The WorkCenter column is a DropDown UI element.
The entries in the WorkCenter Dropdown is populated dynamically based on the material in the each row. For each material the number of WorkCenters can be different.
I have written an operation which gives me the list of WorkCenters for each material passed as an input.
But the problem is that all the WorkCenter Dropdown shows the list of WorkCenters which is returned for the last material in the table, thereby removing uniqueness.
The Node structure is:
Test
---Material
---MaterialDesc
---WorkCenter
The code i have written is as follows:
for(looping til the size of the Node)
{
1. get the material from the current row
2. Pass the material to an operation
3. Get the list of WorkCenters for the particular material
4. populate the DropDown dynamically using the values returned by the operation
}
The code for populating the Dropdown dynamically is :
*IWDAttributeInfo attrDesc = wdContext.nodeTest().getNodeInfo().getAttribute("WorkCenter"); *
ISimpleTypeModifiable simpDesc = attrDesc.getModifiableSimpleType();
IModifiableSimpleValueSet valueDesc = simpDesc.getSVServices().getModifiableSimpleValueSet();
valueDesc.put(<WorkCenterCode>,<WorkCenterDesc>);
Kindly let me know if this code is correct? Also let me if it has to be done in another way.
Regards,
Poojith MV
Hi Poojith MV
According to the code you posted you cannot achieve uniqueness in the drop-down. You are modifying enumeration of attribute 'WorkCenter' for each row, but the enumeration is a part of attribute's type which is common for all elements of the node. In other words, you are modifying the same enumeration several times. As a result it just displays the last enumeration set (for the last row).
You cannot achieve uniqueness with DropDownByKey.
Try DropDownByIndex instead. You have to create child node Test -> WorkCenters. The node should consists of two attributes, workCenterKey and workCenterText. Bind DropDownByIndex to the attributes of the child node.
Ensure the node WorkCenters is not a singleton.
Then create supply-function for the WorkCenters node. Put the code that you have now in iteration of the for(...) into the supply-function. Each invocation of the supply-function shall fill node WorkCenters for the specific material. Current material row will come to the supply-function as parentElement.
Please, notify me if you manage to achieve uniqueness according to the way.
BR, Siarhei
Edited by: Siarhei Pisarenka on Feb 16, 2010 2:48 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Poojith,
Use supply function for populating work center list based on the material number and bind it to work center column in table.
Hope this will helps you.
Thanks
Arun
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Poojith,
I think you should call the populate dropdown method in the operation itself from where you are getting the list of work centres.
Also, you should set the context for that dropdown value there in the operation itself.
Regards
Roshni
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
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.