Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

sortable input #11

Open
tamtakoe opened this issue Jun 6, 2013 · 10 comments
Open

sortable input #11

tamtakoe opened this issue Jun 6, 2013 · 10 comments
Labels

Comments

@tamtakoe
Copy link
Contributor

tamtakoe commented Jun 6, 2013

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

And make demo

@gauravspatel
Copy link

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
Copy link
Contributor

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

@j0hnsmith
Copy link

Handle already works.

@thgreasi
Copy link
Contributor

thgreasi commented Mar 4, 2014

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
Copy link

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
    Copy link

    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/sortable input #11#issuecomment-37280713
    .

  • @thgreasi
    Copy link
    Contributor

    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
    Copy link

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

    @thgreasi
    Copy link
    Contributor

    thgreasi commented May 9, 2014

    @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
    Copy link
    Contributor Author

    tamtakoe commented May 9, 2014

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

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

    No branches or pull requests

    5 participants