Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-4302

Allow set Ajax settings for AjaxCheckBox

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.5.3
    • 1.5.4, 6.0.0-beta1
    • wicket
    • None

    Description

      AjaxCheckBox does not support providing an IAjaxCallDecorator the same way AjaxLink does.
      Beeing able to provide your own ajax decorator is convenient, if you want to run your own code before or after the ajax call is triggered.

      Suggested implementation as in AjaxLink follows:

      public abstract class AjaxCheckBox extends CheckBox {

      public AjaxCheckBox(final String id)

      { this(id, null); }

      public AjaxCheckBox(final String id, final IModel<Boolean> model) {
      super(id, model);

      setOutputMarkupId(true);

      add(new AjaxFormComponentUpdatingBehavior("onclick") {
      private static final long serialVersionUID = 1L;

      @Override
      protected void onUpdate(AjaxRequestTarget target)

      { AjaxCheckBox.this.onUpdate(target); }

      @Override
      protected IAjaxCallDecorator getAjaxCallDecorator()

      { return AjaxCheckBox.this.getAjaxCallDecorator(); }

      });
      }

      /**

      • Returns ajax call decorator that will be used to decorate the ajax call.
        *
      • @return ajax call decorator
        */
        protected IAjaxCallDecorator getAjaxCallDecorator() { return null; }

      /**

      • Listener method invoked on an ajax update call
        *
      • @param target target
        */
        protected abstract void onUpdate(AjaxRequestTarget target);

      }

      Attachments

        Activity

          People

            mgrigorov Martin Tzvetanov Grigorov
            johannes.odland@gmail.com Johannes Odland
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 4h
                4h
                Remaining:
                Remaining Estimate - 4h
                4h
                Logged:
                Time Spent - Not Specified
                Not Specified