You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Manfred Bergmann <mb...@software-by-mabe.com> on 2017/03/13 16:37:20 UTC

Kendo UI - ToolbarButton renders href="#" which removes existing URL fragment

Hi.

The DataTable component has Toolbar-/CommandButtons which seem to be
rendered (by JavaScript) like this:
Button name <#>  

The href="#" causes a problem because once the button is clicked it deletes
the existing URL fragment which must be kept intact.

What could be done to remove the href="#", since it seems to be rendered
after onDomReady or so?


Manfred

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Kendo-UI-ToolbarButton-renders-href-which-removes-existing-URL-fragment-tp4677304.html
Sent from the Users forum 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: Kendo UI - ToolbarButton renders href="#" which removes existing URL fragment

Posted by Manfred Bergmann <mb...@software-by-mabe.com>.
I'll try that. Thanks guys.
Have opened issue on GitHub.


Manfred

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Kendo-UI-ToolbarButton-renders-href-which-removes-existing-URL-fragment-tp4677304p4677312.html
Sent from the Users forum 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: Kendo UI - ToolbarButton renders href="#" which removes existing URL fragment

Posted by Sebastien <se...@gmail.com>.
Hi Manfred, Hi Martin,

Unfortunately this part does not rely on the integration but on kendo-ui
itself, so I'm afraid we have to hack a bit :(

Changing the href attribute should be done when data are loaded, the idea
is to identify buttons with a special css class and update the href on
databound event.
Something like that:

private CommandButton btnEdit = new CommandButton("_edit",
Model.of("Edit")) {

    private static final long serialVersionUID = 1L;

    @Override
    public String getCSSClass()
    {
        return "link-to-change";
    }
};


class MyDataTable {

protected void onInitialize()
{
    super.onInitialize();

    this.add(new DataBoundBehavior() {

        private static final long serialVersionUID = 1L;

        @Override
        protected String getDataBoundCallback()
        {
            return "function (e) { "
                    + "    jQuery('.link-to-change').each("
                    + "        function(index, item) { "
                    + "            jQuery(item).attr('href',
'javascript:;'); "
                    + "        }"
                    + "    )"
                    + "}";
        }
    });
}
}

There should be a way to have a generic Behavior, like
NoHashSymbolOnButtonsDataBoundBehavior (yes, I'm pretty imaginative tonight)
Please open en issue on github :)

Best regards,
Sebastien.

Re: Kendo UI - ToolbarButton renders href="#" which removes existing URL fragment

Posted by Martin Grigorov <mg...@apache.org>.
On Mon, Mar 13, 2017 at 6:21 PM, Manfred Bergmann <mb...@software-by-mabe.com>
wrote:

> Martin Grigorov-4 wrote
> > If Wicket-JQuery-UI adds this "#" then I'd recommend to replace it with
> > href="javascript:;". Some prefer "javascript:void(0)" but this is a bit
> > longer.
> > "#" has such side effects.
>
> OK, how would I do that. Via AttributeModifier? Because it doesn't seem to
> be rendered during the component render phase.
>

You'll have to find who generates this piece of code - KendoUI or
Wicket-JQuery-UI.
I've found just
https://github.com/sebfz1/wicket-jquery-ui/blob/ab7d16751b728aeb6a6652f7554861bdff743b54/wicket-kendo-ui/src/main/java/com/googlecode/wicket/kendo/ui/widget/menu/Menu.html#L41
in Wicket-JQuery-UI, so it might be KendoUI.


>
>
> Manfred
>
> --
> View this message in context: http://apache-wicket.1842946.
> n4.nabble.com/Kendo-UI-ToolbarButton-renders-href-
> which-removes-existing-URL-fragment-tp4677304p4677308.html
> Sent from the Users forum 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: Kendo UI - ToolbarButton renders href="#" which removes existing URL fragment

Posted by Manfred Bergmann <mb...@software-by-mabe.com>.
Martin Grigorov-4 wrote
> If Wicket-JQuery-UI adds this "#" then I'd recommend to replace it with
> href="javascript:;". Some prefer "javascript:void(0)" but this is a bit
> longer.
> "#" has such side effects.

OK, how would I do that. Via AttributeModifier? Because it doesn't seem to
be rendered during the component render phase.


Manfred

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Kendo-UI-ToolbarButton-renders-href-which-removes-existing-URL-fragment-tp4677304p4677308.html
Sent from the Users forum 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: Kendo UI - ToolbarButton renders href="#" which removes existing URL fragment

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

On Mon, Mar 13, 2017 at 5:37 PM, Manfred Bergmann <mb...@software-by-mabe.com>
wrote:

> Hi.
>
> The DataTable component has Toolbar-/CommandButtons which seem to be
> rendered (by JavaScript) like this:
> Button name <#>
>
> The href="#" causes a problem because once the button is clicked it deletes
> the existing URL fragment which must be kept intact.
>
> What could be done to remove the href="#", since it seems to be rendered
> after onDomReady or so?
>

If Wicket-JQuery-UI adds this "#" then I'd recommend to replace it with
href="javascript:;". Some prefer "javascript:void(0)" but this is a bit
longer.
"#" has such side effects.


>
>
> Manfred
>
> --
> View this message in context: http://apache-wicket.1842946.
> n4.nabble.com/Kendo-UI-ToolbarButton-renders-href-
> which-removes-existing-URL-fragment-tp4677304.html
> Sent from the Users forum 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
>
>