# Canjs 3.2.1 can-compute map binding... migrating from Canjs 2.\*

**URL:** <https://forums.bitovi.com/t/canjs-3-2-1-can-compute-map-binding-migrating-from-canjs-2/493>\
**Category:** CanJS\
**Created:** [December 6, 2016, 8:46am UTC](https://forums.bitovi.com/t/canjs-3-2-1-can-compute-map-binding-migrating-from-canjs-2/493 "2016-12-06T08:46:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nothing\_New](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.bitovi.com/nothing_new/32/206_2.png) [@Nothing\_New](https://forums.bitovi.com/u/Nothing_New)\
**Post date:** [December 6, 2016, 8:46am UTC](https://forums.bitovi.com/t/canjs-3-2-1-can-compute-map-binding-migrating-from-canjs-2/493/1 "2016-12-06T08:46:26Z")

</div>

In Canjs 2.\*, because I used the **self.attr( ‘task\_group.task\_group\_link\_support\_user’ );** The template would rerender **availableUsers** when the **task\_group.task\_group\_link\_support\_user** had changed.

```
availableUsers: can.compute(function( viewModel ){
                var self = this;
                if( viewModel ) {
                    self = viewModel;
                }
                self.attr( 'task_group.task_group_link_support_user' );
                return self.attr( 'users.list' ).filter(function( item, index ){
                    var found = false;
                    this.task_group.task_group_link_support_user.each( function( item2, index2 ){
                        if( item2.user_id == item.id ) {
                            found = true;
                            return false;
                        }
                    });
                    return !found;
                }.bind( self ));
            }),

```

I cannot get this to work in Canjs 3.2.1 by doing **self.task\_group.task\_group\_link\_support\_user.get();**

```
availableUsers: Compute(function( ){
        var self = new TaskGroupSupportUserViewModel;
        self.task_group.task_group_link_support_user.get();
        return self.users.list.filter(function( item, index ){
            var found = false;
            this.task_group.task_group_link_support_user.forEach( function( item2, index2 ){
                if( item2.user_id == item.id ) {
                    found = true;
                    return false;
                }
            });
            return !found;
        }.bind( self ));
    }),

```

The template

```
<select class="form-control" ($change)="selectUser( %context, %element, %event )">
                    <option value="">Select...</option>
                    {{#each availableUsers}}
                        <option value="{{id}}" data-index="{{@index}}">{{name}}</option>
                    {{/each}}
                </select>

```

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![Nothing\_New](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.bitovi.com/nothing_new/32/206_2.png) [@Nothing\_New](https://forums.bitovi.com/u/Nothing_New)\
**Post date:** [December 6, 2016, 9:48pm UTC](https://forums.bitovi.com/t/canjs-3-2-1-can-compute-map-binding-migrating-from-canjs-2/493/2 "2016-12-06T21:48:55Z")

</div>

So the problem was that I had to instead of passing Compute.

```
    availableUsers: {
        get: function(){
            this.task_group.task_group_link_support_user;
            return this.users.list.filter(function( item, index ){
                var found = false;
                this.task_group.task_group_link_support_user.forEach( function( item2, index2 ){
                    if( item2.user_id == item.id ) {
                        found = true;
                        return false;
                    }
                });
                return !found;
            }.bind( this ));
        }
    },

```

Thank you, Kevin Phillips for helping me out on chat!
