angular-ui / ui-sortable

jQuery UI Sortable for AngularJS
http://angular-ui.github.io/ui-sortable/
MIT License
1.26k stars 443 forks source link

sortable input #11

Open tamtakoe opened 11 years ago

tamtakoe commented 11 years ago

Add, please, special directive for sortable inputs/textarea, like this http://plnkr.co/edit/iDAEpI?p=preview

And make demo

gauravspatel commented 10 years ago

How would you differentiate a dragging action to select a bunch of text from a want to move the box?

I think the only UI pattern that works here is if you add some sort of anchor that is used explicitly for moving (JqueryUI gives you an option to handle that) and then you keep the default textarea behavior for selecting a bunch of text.

thgreasi commented 10 years ago

@gauravspatel +1 on using the handle option , as a solution to this use case.

j0hnsmith commented 10 years ago

Handle already works.

thgreasi commented 10 years ago

I'm evaluating the case of closing this issue, since the concept of ui-sortable is to provide functionality that is on par with plain jqueryui. Moreover handle would be the obvious choice for anyone coming from the jquery world. I would be happy though, to reference this solution in README if someone is willing to abstract and maintain a separate repo.

LRueckert commented 10 years ago

I have a similar problem in a project I'm working on. I use ui-sortable on a list with inputs as elements. In general it works, meaning the elements can be modified and sorted, but at some point the model and the list get out of sync. In the fiddle i prepared it's not as easy to break as in my actual implementation, but it still does. http://jsfiddle.net/hKYWr/1281/ http://prntscr.com/2zu58x In the screenshot you can see that "two" and "five" are swapped.

Apparently that is due to the fact that i have another dom element in the

  • . i tried it without input in a static list, where i put a the text in a
    and the
    in my
  • which also caused it to break at some point.

    Can someone tell me what i am doing wrong or some sort of workaround?

    thank you in advance

  • gauravspatel commented 10 years ago

    One quick thing to fix is using ng-model instead of ng:model.

    I don't quite understand what steps you're doing to cause the syncage issue. Playing around with the fiddle, nothing seems to unexepected.

    On Tue, Mar 11, 2014 at 5:19 AM, LRueckert notifications@github.com wrote:

    I have a similar problem in a project I'm working on. I use ui-sortable on a list with inputs as elements. In general it works, meaning the elements can be modified and sorted, but at some point the model and the list get out of sync. In the fiddle i prepared it's not as easy to break as in my actual implementation, but it still does. http://jsfiddle.net/hKYWr/1281/ http://prntscr.com/2zu58x In the screenshot you can see that "two" and "five" are swapped.

    Apparently that is due to the fact that i have another dom element in the

  • . i tried it without input in a static list, where i put a the text in a
    and the
    in my
  • which also caused it to break at some point. Can someone tell me what i am doing wrong or some sort of workaround? thank you in advance ## Reply to this email directly or view it on GitHubhttps://github.com/angular-ui/ui-sortable/issues/11#issuecomment-37280713 .
  • thgreasi commented 10 years ago

    First of all, the angular-ui version you are using is old. Angular-ui has splitted and each directive is now a separate module.

    Beside that, I'm not convinced the results you get have something to do with the input. So if the problem persists after you update ui-sortable please open a separate issue.

    PS: performance-wise you should use item.text instead of items[$index].text in the input's ng-model.

    LRueckert commented 10 years ago

    Thank you for the quick responses and tipps. Upgrading to the separate module did the trick.

    thgreasi commented 10 years ago

    @tamtakoe can you create a git repo to host the directive you suggested. I'm planning to add a "satellite projects" section in readme, to host helpful directives like this and the one suggested in #167.

    tamtakoe commented 10 years ago

    Hmmm. I offered it a year ago. I don't understand why jQuery dependency still in angular-ui sortable project. First kill it.