« virusフィルタ偉大 | Main | Builder.nodeとtableとIE »

2006年4月 9日

Sortable.createでonUpdateが効かない

[ カテゴリ: Web ]

scriptaculousにはSortableというコントロールがあります。 その名の通り、部品をソートできるという代物です。 で、ただソートできるだけでは普通は意味がなくて、 変更があったらAJAXでリクエストを投げて欲しいわけですね。 そのためのcallbackがonUpdateです。 しかし、このonUpdate、試してみてもなかなか動きません。

なんでじゃってことで調べ回りました。 てか、scriptaculousのページの構造って欲しい情報に到達しにくいんですけど。 で、結論から言うとそれはFAQにありました。

4.3 The onUpdate callback on Sortable.create doesn’t seem to work!

You’re probably missing the requirements for naming the id attributes in the elements contained in your sortable element. See Sortable.serialize for more on this.

はりゃー。ずーっとSortable.create見てたよ。てか、onUpdateに書いとけよ。 で、Sortable.serializeを見ると、

Important: For this to work, the elements contained in your Sortable must have id attributes in the following form:

 id="string_identifier" 
 // example: id="image_1" 

Only the identifier part of the id attribute will be serialized. If you want to use an other form of id attributes, you need to implement your own serialization.

まーじで。こんなのonUpdateに書いておかないとみんなはまるよ…

Comments

Post a comment




Remember Me?