如何在Seaside回调中访问jQuery事件对象

时间:2021-09-25 19:57:35

Basically, I want to translate the following into Seaside Smalltalk:

基本上,我想将以下内容翻译成Seaside Smalltalk:

$(".myDiv").bind('click', function(e) {
    console.log(e);
}); 

Besides that I don't want to console.log the event, but access it in my ajax callback.

除此之外我不想console.log事件,但在我的ajax回调中访问它。

The most promising approach seemed to be something like

最有希望的方法似乎是这样的

html div
    onClick: (html jQuery ajax callback: [:v | self halt] value: (???);
    with: 'Foo'.

But I couldn't find any way to access the event that caused the callback. Intuitively, I would try

但我找不到任何方法来访问导致回调的事件。直观地说,我会尝试

html jQuery this event

for the ??? part, but the Seaside jQuery wrapper doesn't know any message that comes close to event.

为了 ???部分,但Seaside jQuery包装器不知道任何接近事件的消息。

Any help is appreciated. There has to be away to access the event data...

任何帮助表示赞赏。必须要去访问事件数据......

1 个解决方案

#1


8  

To serialize the x mouse coordinate of the event use the following code:

要序列化事件的x鼠标坐标,请使用以下代码:

html div
    onClick: (html jQuery ajax
        callback: [ :x | x inspect ]
        value: JQEvent new pageX);
    with: 'Click'.

There are other properties in the event object that you might be interested in, just serialize them with the same AJAX request by adding multiple callback:value: constructs in a cascade.

您可能感兴趣的事件对象中还有其他属性,只需通过在级联中添加多个回调:value:constructs来使用相同的AJAX请求对它们进行序列化。

In the very latest JQuery code you can use html jQuery event to create the event object. This was missing up to now.

在最新的JQuery代码中,您可以使用html jQuery事件来创建事件对象。到目前为止,这一点都没有。

#1


8  

To serialize the x mouse coordinate of the event use the following code:

要序列化事件的x鼠标坐标,请使用以下代码:

html div
    onClick: (html jQuery ajax
        callback: [ :x | x inspect ]
        value: JQEvent new pageX);
    with: 'Click'.

There are other properties in the event object that you might be interested in, just serialize them with the same AJAX request by adding multiple callback:value: constructs in a cascade.

您可能感兴趣的事件对象中还有其他属性,只需通过在级联中添加多个回调:value:constructs来使用相同的AJAX请求对它们进行序列化。

In the very latest JQuery code you can use html jQuery event to create the event object. This was missing up to now.

在最新的JQuery代码中,您可以使用html jQuery事件来创建事件对象。到目前为止,这一点都没有。