on 12-11-2007 4:36 AM
Hi
I have a table with 3 dropdowns, country, city and hotel.
This is my context node structure:
HotelTable (0...n)
|_Dropdowns (1...n, Singleton:false)
|_City (attribute, type:string)
|_Country (attribute, type:string)
|_Hotel (attribute, type:string)
|_OtherField1
|_OtherField 2
I am using dropdown by index. I create the first row and populate the dropdowns. I can see this list in the ui table, and it is correct.
In the table, when the user selects a country, it should refresh the city dropdown and the hotel dropdown.
How do I achieve this? I know in the dropdown by key, I can just get the valueset and update the entries. How do I do this here with dropdown by index? Do I create a new instance of the dropdowns node everytime the user changes something and then assign the values based on the country?
Any help will be appreciated.
Thanks
J
Message was edited by:
Jo
Hi manoj,
make the city & hotel attributes as calculated. it will generate getter & setter methods for u. In the setter u can access the country selected & set the values for city & hotel. No need to create instance everytime for dropdown nodes.
regards
Sumit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi all
Thanks so much for your guidance. I have solved the problem.
Instead of using this structure:
HotelTable (0...n)
|_Dropdowns (1...n, Singleton:false)
|_City (attribute, type:string)
|_Country (attribute, type:string)
|_Hotel (attribute, type:string)
|_OtherField1
|_OtherField 2
I used this:
*_HotelTable (0...n)_*
|_*DropdownNodeCity (1...n, Singleton:false)*
|_+City (attribute, type:string)+
|_*DropdownNodeCountry(1...n, Singleton:false)*
|_+Country (attribute, type:string)+
|_*DropdownNodeHotel(1...n, Singleton:false)*
|_+Hotel (attribute, type:string)+
|_+OtherField1+
|_+OtherField 2+
And used the regular way of populating it and setting the lead selection.
Thanks for all help, again.
Regards
J
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
No you don't have to create a new instance of the dropdown node. Based on the selected country, you need to populate a simpleType to the attribute city and then similarly for the hotel. I mean to say, just populate the simpleType of the attrbute city again based on the country selected.
And offCourse you need to do this onAction of the country selected.
This will solve your problem.
thanks & regards,
Message was edited by:
Manoj
Manoj Kumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You have to bind an action to the country dropdown and instantiate the city and hotel node..
Kind Regards,
Saravanan K
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Saravanan
I have bound an action to the country dropdown, and I call a method which invalidates the dropdown node, gets all the data from the rfc node, and in a loop, i check if the country is the same as the country selected in the dropdown, then I create an element of the dropdown node and set city and hotel values.
It still does not work.
Thanks
Hi
This is what Im using now, and it changes the data for the other rows as well:
public void changeHotelList( )
{
//@@begin changeHotelList()
String cityID = wdContext.currentHotelTableElement().currentDropdownsElement().getCityKey();
wdContext.currentHotelTableElement().nodeDropdowns().invalidate();
IPublicVcTrpHotelSearch.IHotelTableElement tableEl = wdContext.currentHotelTableElement();
IPublicVcTrpHotelSearch.IDropdownsElement ddEl;
for(int j=0;j<wdContext.nodeV_Hotel_List().size();j++)
{
ddEl = wdContext.createDropdownsElement();
if(j==0 && wdContext.nodeV_Hotel_List().getV_Hotel_ListElementAt(j).getLocation_Code().equalsIgnoreCase(cityID))
{
ddEl.setCityKey(wdContext.nodeV_Hotel_List().getV_Hotel_ListElementAt(j).getLocation_Code());
ddEl.setCity(wdContext.nodeV_Hotel_List().getV_Hotel_ListElementAt(j).getLocation_Name());
ddEl.setCountryKey(wdContext.nodeV_Hotel_List().getV_Hotel_ListElementAt(j).getCountry_Code());
ddEl.setCountry(wdContext.nodeV_Hotel_List().getV_Hotel_ListElementAt(j).getCountry_Name());
ddEl.setHotelKey(wdContext.nodeV_Hotel_List().getV_Hotel_ListElementAt(j).getHotel_Id());
ddEl.setHotel(wdContext.nodeV_Hotel_List().getV_Hotel_ListElementAt(j).getHotel_Name());
}
else if(j>0 && wdContext.nodeV_Hotel_List().getV_Hotel_ListElementAt(j).getLocation_Code().equalsIgnoreCase(cityID))
{
if(!wdContext.nodeV_Hotel_List().getV_Hotel_ListElementAt(j).getLocation_Code().equalsIgnoreCase(
wdContext.nodeV_Hotel_List().getV_Hotel_ListElementAt(j-1).getLocation_Code()))
{
ddEl.setCityKey(wdContext.nodeV_Hotel_List().getV_Hotel_ListElementAt(j).getLocation_Code());
ddEl.setCity(wdContext.nodeV_Hotel_List().getV_Hotel_ListElementAt(j).getLocation_Name());
}
if(!wdContext.nodeV_Hotel_List().getV_Hotel_ListElementAt(j).getCountry_Code().equalsIgnoreCase(
wdContext.nodeV_Hotel_List().getV_Hotel_ListElementAt(j-1).getCountry_Code()))
{
ddEl.setCountryKey(wdContext.nodeV_Hotel_List().getV_Hotel_ListElementAt(j).getCountry_Code());
ddEl.setCountry(wdContext.nodeV_Hotel_List().getV_Hotel_ListElementAt(j).getCountry_Name());
}
if(!wdContext.nodeV_Hotel_List().getV_Hotel_ListElementAt(j).getHotel_Id().equalsIgnoreCase(
wdContext.nodeV_Hotel_List().getV_Hotel_ListElementAt(j-1).getHotel_Id()))
{
ddEl.setHotelKey(wdContext.nodeV_Hotel_List().getV_Hotel_ListElementAt(j).getHotel_Id());
ddEl.setHotel(wdContext.nodeV_Hotel_List().getV_Hotel_ListElementAt(j).getHotel_Name());
}
}
tableEl.nodeDropdowns().addElement(ddEl);
}
//@@end
}
Whats wrong here?
thanks
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
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.