on 2011 Jun 21 5:36 AM
Hi Friends,
I am using HTMLB Classlib in an Abstract Portal Component to develop a Dropdownlistbox. Now I want to handle the event of change of selection in this dropdown. However, this event is not getting captured. Sample code is as follows:
public class dropdownsimple extends AbstractPortalComponent
{
public void onClick(Event event)
{
}
public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)
{
IPageContext myContext1 = PageContextFactory.createPageContext(request, response);
Form myForm = myContext1.createFormDocument("CRMForm");
GridLayout myGrid = new GridLayout();
DropdownListBox drp = new DropdownListBox("drp");
drp.addItem("Key 1","Item 1");
drp.addItem("Key 2","Item 2");
drp.setOnSelect("onClick");
myGrid.addComponent(1, 1, drp);
myForm.addComponent(myGrid);
myContext1.render();
}
}
I am able to see the dropdown box along with values when I preview the PAR iView created from this component. Please let me know how to capture the event of change of selection in the dropdown?
Edited by: Shetul Chothani on Jun 21, 2011 6:37 AM
Hi,
Change this line
drp.setOnSelect("onClick");
to
drp.setOnSelect("click");
and leave the line
public void onClick(Event event)
as it is, and it should work just fine.
I.e., if you name your event "fooBar", the event handler should be named "onFooBar"
Cheers,
Robin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Robin,
Thank you for the reply... However, this is not working... The behavior of the component is the same... To give you more details, when I change the selection of the value in the dropdown, (say from Item 1 to Item 2), it sets back to Item 1. Moreover, I use Logging to make sure it goes into the Eventing method, but the logger is not getting printed which shows that the eventing method is not getting called.
public void onClick(Event event)
{
tempValue = "Inside onClick Method...";
searchLogger.infoT("Inside Eventing...");
}
I appreciate your thoughts...
Shetul
Hi,
First, the problem is you haven't bind the dropdownbox to a model. I.e. when the onSelect event occurs, the page will get reloaded and rebuilt, without saving the dropdown state. I recommend using a (JSP)DynPage with a bean class.
Second, I would recommend using a DynPage / JSPDynPage since this is intended for HTMLB use. This way, your event has to work
Best,
Robin
Hi Robin,
The requirement demands the usage of only Abstract Portal Component as there is already an existing code on which I have to build.
Could you please elaborate on binding the Dropdownlist with the model? I am new to HTMLB and so I would appreciate it very much if you could provide me with some sample piece of code.
Regards,
Shetul
User | Count |
---|---|
61 | |
11 | |
7 | |
7 | |
7 | |
6 | |
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.