Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ajax/6.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
Ajax Seaside:列表在更新时丢失其内容_Ajax_Smalltalk_Seaside - Fatal编程技术网

Ajax Seaside:列表在更新时丢失其内容

Ajax Seaside:列表在更新时丢失其内容,ajax,smalltalk,seaside,Ajax,Smalltalk,Seaside,这个很简单。我有一个,我想根据选择更新一些内部状态。不需要重新发现任何东西。问题是,在做出选择和AJAX请求之后,列表将丢失其内容 renderContentOn: html |value myId| html form with: [ html select list: #('one' 'two' 'tree' 'four' 'five'); id: (myId := html nextId); callback: [ :

这个很简单。我有一个
,我想根据选择更新一些内部状态。不需要重新发现任何东西。问题是,在做出选择和AJAX请求之后,列表将丢失其内容

renderContentOn: html
|value myId|
    html form with: [
        html select list: #('one' 'two' 'tree' 'four' 'five');
            id: (myId := html nextId);
            callback: [ :v | value := myId ];
            onChange: (
                html prototype updater
                    triggerFormElement: myId;
                    callback: [:h | value "do something with the value here"];
                    return: false
                ).
    ]

因为更新程序用回调生成的内容替换它所定义的元素的html,并且回调不生成任何html,所以我认为列表是空的。

更新程序需要更新元素的DOM ID。如果未能提供ID,则默认为触发事件的DOM元素this。因此,您将得到一个空列表。如果您不需要更新某些内容,则应使用
#request
而不是
#updater
。如果要更新某些内容,需要使用
#ID:
提供有效的ID

阅读Seaside书籍的这一部分,它非常详细地解释了AJAX