Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dragging #22

Closed
s0By opened this issue Mar 7, 2016 · 8 comments
Closed

Dragging #22

s0By opened this issue Mar 7, 2016 · 8 comments

Comments

@s0By
Copy link

s0By commented Mar 7, 2016

I had 48.53 version installed before, decided to take a look on 95.77.
Dragging functionality is just terrible, compared to 48.53 or original nestables.js.
Item get's frozen on it's position, if you make it as a child for example and it's hard to bring it back to parent state etc.
On your demo page it works kinda okey tho.

Any idea what can affect the dragging, I doubt that css does?

@mechanicious
Copy link
Owner

I've recognized this issue. Dragging definitely needs fine-tuning. I'll make sure to incude patch for it in the next release, however, please provide me enough information to reproduce the problem as there can be many possible causes to this unwanted behaviour.

@s0By
Copy link
Author

s0By commented Mar 8, 2016

Noted. Will try to specify more details in the future.
Is there a way to block a particular dd-item from having a "working" content (title) edit?
When domenu kicks in I launch a function that spreads classes based on the domenu json, my json is custom
data: '[{"title":"Account","type":"service"},{"title":"Settings","type":"category"}]'
I was wondering if It's possible to set these custom attributes to json when I create an item?

@mechanicious
Copy link
Owner

Utilize onCreateItem event and the jQuery data method.

...domenu().onCreateItem(function($item) {
  $item.data($.extend(true, $item.data(), {customAttr: "custom value"}));
});

doMenu uses $item.data() of each item to serialize it to JSON.

@s0By
Copy link
Author

s0By commented Mar 9, 2016

It would be a nice enhancement if you'd be able to visually see when you're not allowed to drag under an element (when maxdepth is reached), like here for example.

Are there going to be "shortcut" functions in the future? Like getParent() of an element etc.?

Currently trying to achieve a block for element, similar to maxdepth behavior, but not sure if it's possible yet in this solution.

I need to to utilize onItemDrag so when I try to put an element under some other (the other element is parent) and if that element has my "special" attribute, then I can't put it there. Had no success achieving that, does the script understand which item is parent while in onItemDrag state or does it understand that only in onItemDrop state?

@mechanicious
Copy link
Owner

There will be an separate API for items included in the next release which will feature methods alike.

Try to establish the parent using the corresponding placeholder as specified by the placeClass option.

@s0By
Copy link
Author

s0By commented Mar 21, 2016

placeClass can do the job, but in order to utilize it I need an event, something like onItemMove which would kick in from dragMove, so it would track everything that's happening with the item that is dragged. Well, necessity of utilizing placeClass disappears because in this case it would be simpler to do something like getParent() because script is setting the parent in dragMove.

It would be great to have some output varieties for the flexibility of the plugin, like toArray, toHierarchy etc (idea from nestedSortable, looks handy).

I though nestable dragging was done well enough, why did you decide to tune it? Any approx. date when new release is coming?

@mechanicious
Copy link
Owner

@s0By Check out 0.99.77-rc1 it improves dragging and introduces the placeholder max-depth state.

@coolboy4598
Copy link

@s0By can you please tell me how to do this?

I don't want to allow parent be child of another parent. But yes it should be allowed to drag as need to allow sorting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants