Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在seaside中返回tableData上方tableHeading的值?_Javascript_Jquery_Ajax_Smalltalk_Seaside - Fatal编程技术网

Javascript 如何在seaside中返回tableData上方tableHeading的值?

Javascript 如何在seaside中返回tableData上方tableHeading的值?,javascript,jquery,ajax,smalltalk,seaside,Javascript,Jquery,Ajax,Smalltalk,Seaside,在原始jQuery中,您可以使用 var $th = $td.closest('table').find('th').eq($td.index()); 但是,我如何将$th返回到seaside,这样我就可以将它用作我想要的任何格式的字符串? 例如 val do:[:e | e class = Dictionary ifTrue:[ html tableData onDoubleClick: (ht

在原始jQuery中,您可以使用

var $th = $td.closest('table').find('th').eq($td.index());
但是,我如何将
$th
返回到seaside,这样我就可以将它用作我想要的任何格式的字符串? 例如

val do:[:e |
e class = Dictionary ifTrue:[
                        html tableData 
                        onDoubleClick: (html javascript alert: 'double clicked column'); 
                        with:[self renderTargets: e on: html]
                           ]
         ]
所以基本上我想要的是:

(((html jQuery this) next: 'td') closest: 'table'; find: 'th'; eq: ((html jQuery this) next: 'td') index; html).
然后把它放在

...column', thValue);
除了seaside,我对javascript、jquery或ajax都不太了解

WWLD?
感谢

将一个值从网页传回服务器,您可以使用jQuery进行ajax回调。大致如下:

html tableData 
      onDoubleClick: (html jQuery ajax 
                            callback: [:v | .. do something with v... ]
                            value: ((((html jQuery this)) closest: 'table') find: 'th' ...)
#callback:value:message的第一个参数(即回调块)将在服务器端使用其第二个参数(即javascript表达式)的客户端计算值进行计算

看看JQAjax层次结构。您将注意到#callback:value:method的许多变体(例如,使用json、乘客等)

此外,您还可以将#callback:value:callback与响应呈现ajax回调(如#script:callback)结合起来,在客户端执行脚本。您甚至可以在不同的回调块之间传递值:

html jQuery ajax
      callback: [:v | theValue := v]
      value: ((((html jQuery this)) closest: 'table') find: 'th' ...);
      script: [:s | s << (s alert: theValue)]
html jQuery-ajax
回调:[:v |值:=v]
值:(((html jQuery this))最近的:'table')查找:'th'…);

脚本:[:s | s那是“卢卡斯会怎么做?”?这很有效,我学到了一些新东西。但是,如果我把
[:v | html javascript alert:v]
放进去,它不会发出警报。如果我放
Transcript cr;show:v
我会得到成绩单中的值(这意味着它有效).
html表格数据在双击:(html javascript警报:(((html jQuery this)最近的:'table';find:'th';eq:(html jQuery this)索引;attributeeat:'id'))
A#回调:值:ajax调用不会在客户端生成响应。如果要在客户端执行警报,则需要使用响应呈现回调。我编辑了我的响应以回答您的其他问题。