on-select-all="fSelectAll()"
output-model is not updated when using on-select-all property.
It would be very helpful for me if you could provide how to get the length of the output-model when select the " on-select-all" option.
Hi @karthicjayaraman ,
Can you please help to replicate the problem in JsFiddler or Plunker?
Can reproduce here. The output model is updated, but only AFTER the on-select-all callback has occurred. We need to do a $watch on the output model instead, which to me seems dirty.
@JeffreyATW ,
I see.. so in other words, during on-select-all callback, the output-model is NOT YET updated (still showing old values)?
Does this also happen in on-select-none?
- Edit: I prefer not to $watch output-model here.. There are 2 $watches inside the code and I believe it's enough.
Yes, happens in both.
@JeffreyATW , @karthicjayaraman
Thanks for the info. This is what I'm afraid most.. it happened before, and it forced me to use the $timeout. I'll see what I can do about this.
Great .. Thanks a lot for the response .
On Wed, Jul 1, 2015 at 1:59 AM, Steven [email protected] wrote:
@JeffreyATW https://github.com/JeffreyATW , @karthicjayaraman https://github.com/karthicjayaraman
Thanks for the info. This is what I'm afraid most.. somehow the changes is not yet reflected back at the controller. I'll see what I can do about this.
— Reply to this email directly or view it on GitHub https://github.com/isteven/angular-multi-select/issues/307#issuecomment-117550162 .
I had the same issue but it is solved when you specify property of what should be updated in output model:
output-properties="id name ticked"
Nope, we have that set. It works for on-item-click but not on-select-all or on-select-none.
Hi all,
Sorry but my current project leaves me almost no time to update the directive.
@JeffreyATW , does $watch-ing the output-model work?
Yes.
changing a line worked for me.
this line: $scope.onSelectAll();
to this:
$timeout( function() { $scope.onSelectAll(); }, 0 );
Hi all,
I recently hit similar problem in a complex page, and, after browsing around, one possible solution is simply to add child object on the output-model, like this:
<isteven-multi-select
input-model="someData"
output-model="awesomeOutput.data" // Add .data
tick-property="status"
on-select-all="showSelected()"
....
Then in your controller, as usual:
$scope.showSelected = function() {
console.log( $scope.awesomeOutput.data );
}
I hope this helps.
@prabuinet , I personally don't think the $scope.onSelectAll() function should be enclosed within $timeout as it does not involve complex DOM operation (it's just a button click afterall). But hey, as long as it solves the problem :sunglasses: :thumbsup:
Further reading: http://juristr.com/blog/2014/11/learning-ng-databinding-doesnt-work/
I am still having issue with this for both the select-all and select-none. Has it not been resolved? If not, what $watch statement do you recommend?
Thanks.
@astropcrb ,
Does adding child object on the output-model work for you?
<isteven-multi-select
input-model="someData"
output-model="awesomeOutput.data" // Add .data
tick-property="status"
on-select-all="showSelected()"
....
Then in your controller, as usual:
$scope.showSelected = function() {
console.log( $scope.awesomeOutput.data );
}
Hi !
I also have the same problem, but only for on-select-all. I tried your solution by adding a child object and a log in the controller, but it does not work for me.
Any update :) ?
Thanks for the great directive but I am still having issue with this for both the select-all and select-none. Any plans on fixing this?
Here's a fix for this issue: https://github.com/isteven/angular-multi-select/pull/461
Any ideas what is best way to intercept click event on "Select All" button? As I read few comments above, using another $watch will make my code stink.
What I want to achieve, is catch click event on "Select All" button and either accept if some conditions are met or block and reject the operation of selecting all objects.
Docs for on-select-all states:
A $scope function to call when "select all" button is clicked. You need to define this function in your controller.
but it's not clear to me, the callback on-select-all is triggered before, at the same time or after the item is clicked?
@aryniec,
It's triggered after all items' selection property is set to TRUE.
Generally speaking, all events are triggered after the selection changes happen.
@isteven then what would be best way to intercept this "Select All" click, both Angular 1.5 and angular-multi-select way?