You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by CrocodileShoes <ma...@googlemail.com> on 2009/03/25 10:23:34 UTC

AttributeModifier in AjaxLink's onClick. Possible?

Can I do this?

MarkupContainer facetNameLink = new AjaxLink("facetNameLink") {
  @Override
  public void onClick(AjaxRequestTarget target) {
    // Get the dataprovider's query response
    SolrQuery query = responseModel.getQuery();
    // Set the query back to the beginning.
    query.setStart(0);
    // Add the clicked facet as a filter query on the solr query
    query.addFilterQuery(ffcount.getAsFilterQuery());
								
    this.add(new SimpleAttributeModifier("id", "facetFieldTitleSelected"));
    target.addComponent(this);
    this.setResponsePage(getPage());
  }
}.add(new Label("facetName", ffcount.getName()));
						
facetNameLink.setOutputMarkupId(true);


Nothing seems to change in the markup so i'm doing something stupid
somewhere.  Note everything else works as expected apart from the
AttributeModifier.

Cheers
-- 
View this message in context: http://www.nabble.com/AttributeModifier-in-AjaxLink%27s-onClick.--Possible--tp22697831p22697831.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: AttributeModifier in AjaxLink's onClick. Possible?

Posted by nino martinez wael <ni...@gmail.com>.
No problem :)

2009/3/25 CrocodileShoes <ma...@googlemail.com>

>
> Ah Ok.  After a quick search through the wiki I came up with this:
>
> @Override
> protected IAjaxCallDecorator getAjaxCallDecorator() {
>  return new AjaxCallDecorator() {
>    public CharSequence decorateScript(CharSequence script) {
>      // add Javascript to change id here
>      return "" + script;
>    }
>  };
> }
>
> Now I have to look up the Javascript.
>
> Thanks, Nino.
> --
> View this message in context:
> http://www.nabble.com/AttributeModifier-in-AjaxLink%27s-onClick.--Possible--tp22697831p22698229.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: AttributeModifier in AjaxLink's onClick. Possible?

Posted by CrocodileShoes <ma...@googlemail.com>.
Ah Ok.  After a quick search through the wiki I came up with this:

@Override
protected IAjaxCallDecorator getAjaxCallDecorator() {
  return new AjaxCallDecorator() {
    public CharSequence decorateScript(CharSequence script) {
      // add Javascript to change id here
      return "" + script;
    }
  };
}

Now I have to look up the Javascript.

Thanks, Nino.
-- 
View this message in context: http://www.nabble.com/AttributeModifier-in-AjaxLink%27s-onClick.--Possible--tp22697831p22698229.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: AttributeModifier in AjaxLink's onClick. Possible?

Posted by nino martinez wael <ni...@gmail.com>.
No theres a ajax decorator you can override instead, or something like it...

2009/3/25 CrocodileShoes <ma...@googlemail.com>

>
> Can I do this?
>
> MarkupContainer facetNameLink = new AjaxLink("facetNameLink") {
>  @Override
>  public void onClick(AjaxRequestTarget target) {
>    // Get the dataprovider's query response
>    SolrQuery query = responseModel.getQuery();
>    // Set the query back to the beginning.
>    query.setStart(0);
>    // Add the clicked facet as a filter query on the solr query
>    query.addFilterQuery(ffcount.getAsFilterQuery());
>
>    this.add(new SimpleAttributeModifier("id", "facetFieldTitleSelected"));
>    target.addComponent(this);
>    this.setResponsePage(getPage());
>  }
> }.add(new Label("facetName", ffcount.getName()));
>
> facetNameLink.setOutputMarkupId(true);
>
>
> Nothing seems to change in the markup so i'm doing something stupid
> somewhere.  Note everything else works as expected apart from the
> AttributeModifier.
>
> Cheers
> --
> View this message in context:
> http://www.nabble.com/AttributeModifier-in-AjaxLink%27s-onClick.--Possible--tp22697831p22697831.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>