javascriptjqueryjquery-uipharoseaside

Seaside & jQuery UI: Sortable list not working?


Beginner here. I'm currently trying to learn Seaside, and how to integrate jQuery with it. I've been trying to implement some of the examples provided in the Seaside jQuery UI Functional Test Suite in my own image.

For some reason, I can't get a sortable list to work. I copy & pasted the code from the example but it doesn't work. I have made sure to add the jQuery library, and have tested that it works with a clickable animated heading. But my sortable list just gets rendered with no interaction.

Inspecting the page source does reveal an error message: "TypeError: undefined is not a function(...)", but I don't understand what this means?

Any help would be greatly appreciated. I want to get the hang of this and need to understand why it's not working. See my code below, as copied exactly from their example, with the exception of assigning a list to the items variable:

| items |
    items := OrderedCollection newFrom: {'peas' . 'carrots' . 'beetroot'}.
   html unorderedList
      script: (html jQuery new sortable
         onStop: (html jQuery ajax
            callback: [ :values | items := values ]
            passengers: (html jQuery this find: 'li')));
      with: [
         items do: [ :each |
            html listItem
               class: 'ui-corner-all';
               passenger: each;
               with: each ] ]

And including the jQuery code as rendered in the browser:

function onLoad() {
        $("#id3").sortable({              <-- TypeError occurs here
            "stop": function() {
                $.ajax({
                    "url": "/jquery",
                    "data": ["_s=To5SuUU8YuW_HSjD", "_k=MpvlOw_BWjmgF9Uy", "1", "2=" + encodeURIComponent($.map($(this).find("li").get(), function(each) {
                        return each.id
                    }).join(","))].join("&")

Solution

  • Did you also add the jQueryUI library? I would think the 'sortable' is not found on a jQuery... so it probably is not loaded.