Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4838

Ember models table updating by computed filter property

$
0
0

@SowmyaManohar wrote:

Hi all,

Am new to ember . Trying to filter the data in ember side using ember filter(computed property). I have used ember model table data to display it. The code loads the model and displays well at first go.when i try to filter it , it says no records to show. my code: controller: users: alias(‘model’), currentFilter: null,

filteredPeople: filter('users', function(user) {
  alert(this.get('currentFilter'));
  if(this.get('currentFilter') === null) {
    return true;
  } else {
    return user.isActive === this.get('currentFilter');
  }
}).property('users', 'currentFilter'),

actions: {
   
  filterUpdated: function (value) {
    
    alert(value);
    if (value=== null) {
      this.set('currentFilter', null);
    }
    else {
      this.set('currentFilter', value);
    }
  }

the .hbs code:

Show: All Active Inactive
{{models-table data=filteredPeople columns=columns showColumnsDropdown=false useNumericPagination=true filteringIgnoreCase=true showPageSize=true
selectedItems=selectedItems

multipleSelect=true customIcons=customIcons }}

any idea what is happening ? ( when i give the current filter as true or false on the first go it gives correct display)

Posts: 9

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 4838

Trending Articles