Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to implement onMove?

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

1 Solution

Accepted Solutions
Not applicable
Author

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

View solution in original post

1 Reply
Not applicable
Author

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