Re: SimpleAttributeModifier and AbstractDefaultAjaxBehavior incompatibily

2010-01-14 Thread Alexandru Barbat
I found how I should do in place of getCallbackScript() I should call
getEventHandler()  in the renderHead method but with
AjaxFormComponentUpdatingBehavior
>
> .
>

it works like charm.

Thank you pedro.



On Thu, Jan 14, 2010 at 3:25 PM, Pedro Santos  wrote:

> You can take a look at AjaxFormComponentUpdatingBehavior, this behavior
> will
> keep the 'judet' field model data updated.
> About the generated id, this is the default behavior, you can override the
> onBind method to avoid id. But later you will can not add the component to
> an AjaxRequestTarget, so see if you can work with the generated id.
>
> On Thu, Jan 14, 2010 at 11:11 AM, Alexandru Barbat <
> alexandrubar...@gmail.com> wrote:
>
> > Hello,
> >
> > ..
> > AbstractDefaultAjaxBehavior behave = new AbstractDefaultAjaxBehavior() {
> >protected void respond(AjaxRequestTarget target) {
> >target.addComponent(orasListPanel);
> >}
> >
> >public void renderHead(IHeaderResponse response) {
> >super.renderHead(response);
> >response.renderJavascript("function load_orase(){\n" +
> > getCallbackScript().toString() + "\nalert('ok');\n}", "loadOrase");
> >}
> >
> >};
> >
> >
> >TextField judet = new TextField("judetSelectat");
> >judet.add(new SimpleAttributeModifier("id","judetSelectat"));
> > ///x
> >judet.add(behave);
> >
> > ..
> >
> >
> > I use this to generate a js function in order to call it from flash
> > component but it does't work at all because o line ///.
> > SimpleAttributeModifier change the element id but the
> > AbstractDefaultAjaxBehaviour doesn;t take that in account.. it use the
> > generated id.  This is one problem. How I could overcome that?
> >
> >
> > And second, even if I don't change the id of 'judetSelectat' and even if
> > the
> > behaviour it is called the model of the 'judet' field it is not called.
> > Why?
> >
> >
> > Thank you,
> >
> > Alexandru
> >
>
>
>
> --
> Pedro Henrique Oliveira dos Santos
>


Re: SimpleAttributeModifier and AbstractDefaultAjaxBehavior incompatibily

2010-01-14 Thread Alexandru Barbat
I changed the code to AjaxFormComponentUpdatingBehavior but it seems the js
generated by this behavior
getCallbackScript() is the same with AbstractDefaultAjaxBehavior and I have
same results if I call that script from
my flash component.

..

function load_orase(){
var 
wcall=wicketAjaxGet('?wicket:interface=:0:sidebar:oraseForm:judetSelectat::IBehaviorListener:0:',null,null,
function() {return Wicket.$('judetSelectat2') != null;}.bind(this));
alert('ok');
}

..


Indeed AjaxFormComponentUpdatingBehavior generate on my field 'onchange'
attribute js which is good. How can I intercept this script and call it
programatically.




Thank you,
Alexandru



On Thu, Jan 14, 2010 at 3:25 PM, Pedro Santos  wrote:

> You can take a look at AjaxFormComponentUpdatingBehavior, this behavior
> will
> keep the 'judet' field model data updated.
> About the generated id, this is the default behavior, you can override the
> onBind method to avoid id. But later you will can not add the component to
> an AjaxRequestTarget, so see if you can work with the generated id.
>
> On Thu, Jan 14, 2010 at 11:11 AM, Alexandru Barbat <
> alexandrubar...@gmail.com> wrote:
>
> > Hello,
> >
> > ..
> > AbstractDefaultAjaxBehavior behave = new AbstractDefaultAjaxBehavior() {
> >protected void respond(AjaxRequestTarget target) {
> >target.addComponent(orasListPanel);
> >}
> >
> >public void renderHead(IHeaderResponse response) {
> >super.renderHead(response);
> >response.renderJavascript("function load_orase(){\n" +
> > getCallbackScript().toString() + "\nalert('ok');\n}", "loadOrase");
> >}
> >
> >};
> >
> >
> >TextField judet = new TextField("judetSelectat");
> >judet.add(new SimpleAttributeModifier("id","judetSelectat"));
> > ///x
> >judet.add(behave);
> >
> > ..
> >
> >
> > I use this to generate a js function in order to call it from flash
> > component but it does't work at all because o line ///.
> > SimpleAttributeModifier change the element id but the
> > AbstractDefaultAjaxBehaviour doesn;t take that in account.. it use the
> > generated id.  This is one problem. How I could overcome that?
> >
> >
> > And second, even if I don't change the id of 'judetSelectat' and even if
> > the
> > behaviour it is called the model of the 'judet' field it is not called.
> > Why?
> >
> >
> > Thank you,
> >
> > Alexandru
> >
>
>
>
> --
> Pedro Henrique Oliveira dos Santos
>


SimpleAttributeModifier and AbstractDefaultAjaxBehavior incompatibily

2010-01-14 Thread Alexandru Barbat
Hello,

..
AbstractDefaultAjaxBehavior behave = new AbstractDefaultAjaxBehavior() {
protected void respond(AjaxRequestTarget target) {
target.addComponent(orasListPanel);
}

public void renderHead(IHeaderResponse response) {
super.renderHead(response);
response.renderJavascript("function load_orase(){\n" +
getCallbackScript().toString() + "\nalert('ok');\n}", "loadOrase");
}

};


TextField judet = new TextField("judetSelectat");
judet.add(new SimpleAttributeModifier("id","judetSelectat"));
///x
judet.add(behave);

..


I use this to generate a js function in order to call it from flash
component but it does't work at all because o line ///.
SimpleAttributeModifier change the element id but the
AbstractDefaultAjaxBehaviour doesn;t take that in account.. it use the
generated id.  This is one problem. How I could overcome that?


And second, even if I don't change the id of 'judetSelectat' and even if the
behaviour it is called the model of the 'judet' field it is not called.
Why?


Thank you,

Alexandru


Re: SimpleAttributeModifier and AbstractDefaultAjaxBehavior incompatibily

2010-01-14 Thread Pedro Santos
You can take a look at AjaxFormComponentUpdatingBehavior, this behavior will
keep the 'judet' field model data updated.
About the generated id, this is the default behavior, you can override the
onBind method to avoid id. But later you will can not add the component to
an AjaxRequestTarget, so see if you can work with the generated id.

On Thu, Jan 14, 2010 at 11:11 AM, Alexandru Barbat <
alexandrubar...@gmail.com> wrote:

> Hello,
>
> ..
> AbstractDefaultAjaxBehavior behave = new AbstractDefaultAjaxBehavior() {
>protected void respond(AjaxRequestTarget target) {
>target.addComponent(orasListPanel);
>}
>
>public void renderHead(IHeaderResponse response) {
>super.renderHead(response);
>response.renderJavascript("function load_orase(){\n" +
> getCallbackScript().toString() + "\nalert('ok');\n}", "loadOrase");
>}
>
>};
>
>
>TextField judet = new TextField("judetSelectat");
>judet.add(new SimpleAttributeModifier("id","judetSelectat"));
> ///x
>judet.add(behave);
>
> ..
>
>
> I use this to generate a js function in order to call it from flash
> component but it does't work at all because o line ///.
> SimpleAttributeModifier change the element id but the
> AbstractDefaultAjaxBehaviour doesn;t take that in account.. it use the
> generated id.  This is one problem. How I could overcome that?
>
>
> And second, even if I don't change the id of 'judetSelectat' and even if
> the
> behaviour it is called the model of the 'judet' field it is not called.
> Why?
>
>
> Thank you,
>
> Alexandru
>



-- 
Pedro Henrique Oliveira dos Santos


SimpleAttributeModifier and AbstractDefaultAjaxBehavior incompatibily

2010-01-14 Thread Alexandru Barbat
Hello,

..
AbstractDefaultAjaxBehavior behave = new AbstractDefaultAjaxBehavior() {
protected void respond(AjaxRequestTarget target) {
target.addComponent(orasListPanel);
}

public void renderHead(IHeaderResponse response) {
super.renderHead(response);
response.renderJavascript("function load_orase(){\n" +
getCallbackScript().toString() + "\nalert('ok');\n}", "loadOrase");
}

};


TextField judet = new TextField("judetSelectat");
judet.add(new SimpleAttributeModifier("id","judetSelectat"));
///x
judet.add(behave);

..


I use this to generate a js function in order to call it from flash
component but it does't work at all because o line ///.
SimpleAttributeModifier change the element id but the
AbstractDefaultAjaxBehaviour doesn;t take that in account.. it use the
generated id.  This is one problem. How I could overcome that?


And second, even if I don't change the id of 'judetSelectat' and even if the
behaviour it is called the model of the 'judet' field it is not called.
Why?


Thank you,

Alexandru