Hi Maxim,

As Sven already showed in the code the way to get the jQuery event is:
attrs.event
'attrs' is the settings object that Wicket generates from the
AjaxRequestAttributes at the server side (see #updateAjaxAttributes()).
At the client side the jQuery event is added to this JS object and the
object itself is passed as a parameter to all callback functions: before,
beforeSend, precondition, complete, ...
See
https://ci.apache.org/projects/wicket/guide/8.x/single.html#_working_with_ajax
for more info.

About your second question - how to debug those functions: just add
"debugger;" in the JS code.
If the browser Dev Tools are opened then the browser will suspend the
execution at this special expression.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Tue, Jan 17, 2017 at 7:23 PM, Sven Meier <s...@meiers.net> wrote:

> Hi,
>
> you should be able to add a dynamic extra attribute:
>
>     protected MarkupContainer newLinkComponent(String id, IModel<T> model)
>     {
>         return new AjaxLink<Void>(id)
>         {
>             @Override
>             public boolean isEnabled()
>             {
>                 return StyledLinkLabel.this.isClickable();
>             }
>
>             @Override
>             protected void updateAjaxAttributes(AjaxRequestAttributes
> attributes)
>             {
>                 super.updateAjaxAttributes(attributes);
>
>                 attributes.getDynamicExtraParameters().add("function(attrs)
> { return { 'modifiers' : modifiers(attrs.event) }; }");
>             }
>
>             @Override
>             public void onClick(AjaxRequestTarget target)
>             {
>                 String modifier = getRequest().getRequestParamet
> ers().getParameterValue("modifiers").toOptionalString();
>             }
>         };
>     }
>
> I didn't try it, but I think all you have to do is to provide a
> #modifiers(event) to encode all pressed modifier keys.
>
> Have fun
> Sven
>
>
>
> On 17.01.2017 18:30, Maxim Solodovnik wrote:
>
>> I have started implementing this :)
>> Used this [1] as an example
>>
>> I have one proposal:
>>
>> To add method updateAjaxAttributes to StyledLinkLabel (to reduce amount of
>> copy/paste :)), I can create PR, it seems to be trivial :)
>>
>> And one question:
>>
>> To have ctrl/shift I need original MouseEvent, how can I get it? (found no
>> way to debug these dynamic JS functions :( )
>>
>> Thanks in advance
>>
>> [1] https://issues.apache.org/jira/browse/WICKET-5306
>>
>> On Thu, Dec 22, 2016 at 2:14 PM, Maxim Solodovnik <solomax...@gmail.com>
>> wrote:
>>
>> Sounds doable :)
>>> I was hoping this is already implemented, so I can use it :)
>>> Will implement myself :)
>>>
>>> On Thu, Dec 22, 2016 at 2:06 PM, Sven Meier <s...@meiers.net> wrote:
>>>
>>> Hi Maxim,
>>>>
>>>> you'd have to transport information about the currently pressed keys to
>>>> the server (via AjaxRequestAttributes dynamic extra parameters).
>>>>
>>>> There it is just a matter of managing selection state and visually
>>>> marking the components accordingly.
>>>>
>>>> Sounds complicated?
>>>>
>>>> Sven
>>>>
>>>>
>>>> On 22.12.2016 05:44, Maxim Solodovnik wrote:
>>>>
>>>> Hello All,
>>>>>
>>>>> Maybe someone has any working examples of multi-node selection
>>>>> in DefaultNestedTree using Crtl/Shift keys?
>>>>>
>>>>> Thanks in advance
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>>
>>>>
>>>>
>>> --
>>> WBR
>>> Maxim aka solomax
>>>
>>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

Reply via email to