on 11-22-2011 10:17 AM
Hi everyone,
In WD, How to get a first value as a default value for a dropdown.?? I Am not storing the values in domain. I Am appending the values.
Can anyone help us,
Thanks and regards,
vijay
Hi
In the dropdown if you do not want a blank value to appear first then make the node's selection as 1..1. By doing this the 1st value in the dropdown would by default be the 1st value you are appending to the node.
There is another alternative if you want to retain the 1st blank entry. You can use
LV_NODE->SET_LEAD_SELECTION_INDEX( 0 ). //defaults to the 1st element in the node
where lv_node is the reference to the node.
Thanks & Regards,
Gayathri Shanbhag
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vijay
1. If you are using dropdown by key, then you can setSelectedKey to the key of the key value pair, the value of which you want to be the default value.
2. If you are using dropdown by value then in the code you have to get the reference of the node(through code generator->Read a node and select the node the dropdown is bound to, to get the reference to the node.) and set the lead selection using the following code. Here,say lv_node is the reference to the node you have got
LV_NODE->SET_LEAD_SELECTION_INDEX( 0 )
Thanks & Regards,
Gayathri Shanbhag
Hi Vijay
How are you populating values into your dropdown? And it is a dropdown by index or dropdown by key??
if your values are not fixed, you can still set default value in the method where you are populating the values dynamically. You would have bound the selected key to some attribute right? Use some logic through code to set the default value to that attribute to which you have bound the selectedkey. Say you want to set the dropdown value to the current financial year all the time you can use sy datum to get the timestamp and extract the date from that and then set the selected key to (currentyear-(currentyear+1)). This is just an example.
Thanks & Regards,
Gayathri Shanbhag
Hi Vijay
If you have got the default value you want to set through your logic, then just set that value you have got to the drop down selected key attribute you have defined. Any value you set to the selected key will be reflected as the default value for that dropdown.
Thanks and Regards,
Gayathri Shanbhag
Hi,
if you have internal table by which you have appended values then afer binding the table, you can use set_lead_selection method as shown below to set the 1st value as default one.
node->bind_table( int_dd_value).
node->set_lead_selection_index( 1 ).
I am not sure if this is what you are looking for.
Thanks,
Chandra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
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.