Git Product home page Git Product logo

Comments (3)

isteven avatar isteven commented on August 22, 2024 1

Hi Bram,

I understand your problem. Some people also asked me more or less the same thing. They need this "on-change" or "on-item-click" or sort - basically a callback when you select or deselect an item.

I am going to include this feature on the next release. For now you can use $watch. Don't forget to set the third parameter to "true":

$scope.$watch( $yourModel, yourListenerFunction(), true );

The reason I am going to add that "on-change" or "on-item-click" callback is because $watch with the third parameter set to "true" affects performance, especially on models with complex structure.

At the moment I am working on the next version of this directive, which will add:

  • the on-item-click callback. This callback will pass the item that you click as a parameter.
  • Unlimited nested grouping.
  • Better keyboard control (using up & down arrow)
  • Some clean ups & optimizations (Still, don't expect it to win any code performance competition).
  • May remove some non-popular features such as on-focus or on-blur

Do star this repository so that you can get update on the new version.

Lastly, I saw your profile and I understand that you are new on Github, so welcome!

Regards,
Steven

from angular-multi-select.

isteven avatar isteven commented on August 22, 2024

Hi @Werewolfkiss,

I think you can use the on-open callback for this purpose.

Remove the ng-click attribute and add on-open="getDataByUser(selectedUserList)" attribute.

from angular-multi-select.

Werewolfkiss avatar Werewolfkiss commented on August 22, 2024

Hello Steven,

I do want the function to be called on each selection change, so not only
when the entire menu is opened.
So on-open doesnt work for me. I also tried on-blur, but that is totally
unpredictable.

I do notice that with ng-click, the function gets called once with the old
selectedUserList and once with the updated selectedUserList.

So when nothing is selected and I select user1:

  • getDataByUser([])
  • getDataByUser([user1])

And if I then select user2

  • getDataByUser([user1])
  • getDataByUser([user1, user2])

And then deselect user1

  • getDataByUser([user1,user2])
  • getDataByUser([user2])

I guess I might be able to work around it with a
$scope.$watch($selectedUserList, getDataByUser($selectedUserList)), but i'd
rather have it work properly from inside the multi-select.

Kind regards,

Bram Verspeek

On Mon, Jun 23, 2014 at 5:04 PM, Steven [email protected] wrote:

Hi @Werewolfkiss https://github.com/Werewolfkiss,

I think you can use the on-open callback for this purpose.

Remove the ng-click attribute and add
on-open="getDataByUser(selectedUserList)" attribute.


Reply to this email directly or view it on GitHub
#27 (comment)
.

from angular-multi-select.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.