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