1 Reply Latest reply: Dec 1, 2014 5:00 PM by Karl Fredberg RSS

    How to implement onMove?

    Karl Fredberg

      If I have a property of type array and allowMove is set to true. When I move an item the property panel is updated but I get this error

      TypeError: undefined is not a function at Object.f.sortableOptions.onMove

      I have tried to add sortableOptions to the definition of the array and to the items in the array but it doesn't work.

       

      How can I fix this?

      Cheers

      Karl

        • Re: How to implement onMove?
          Karl Fredberg

          I figured out a way to fix the problem. I don't no if it's the right way but it works.

           

          I created a component based of the list component, but change the onMove function and changed the last row.

          onMove: function(old_index, new_index) {
            if (new_index >= f.listData.length) {
                  var k = new_index - f.listData.length;
                  while ((k--) + 1) {
                      f.listData.push(undefined);
                  }
              }
              f.listData.splice(new_index, 0, f.listData.splice(old_index, 1)[0]);
              f.$emit("saveProperties");
            }
          ...
          return a.addComponent("kfMeasureList", g), g
          

           

          I used the new component in my extension and change the component property to kfMeasureList