ui-sortable icon indicating copy to clipboard operation
ui-sortable copied to clipboard

sortable input

Open tamtakoe opened this issue 12 years ago • 10 comments

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

And make demo

tamtakoe avatar Jun 06 '13 00:06 tamtakoe

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.

gauravspatel avatar Jan 27 '14 04:01 gauravspatel

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

thgreasi avatar Jan 27 '14 17:01 thgreasi

Handle already works.

j0hnsmith avatar Feb 27 '14 20:02 j0hnsmith

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.

thgreasi avatar Mar 04 '14 17:03 thgreasi

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

  • LRueckert avatar Mar 11 '14 10:03 LRueckert

    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 [email protected] 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 .

  • gauravspatel avatar Mar 11 '14 13:03 gauravspatel

    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.

    thgreasi avatar Mar 11 '14 17:03 thgreasi

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

    LRueckert avatar Mar 11 '14 17:03 LRueckert

    @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.

    thgreasi avatar May 09 '14 17:05 thgreasi

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

    tamtakoe avatar May 09 '14 18:05 tamtakoe