2015-03-31 207 views
0

我设置身份验证功能:客户端过滤器不alethes工作:流星页

UsersPagination = new Meteor.Pagination(Meteor.users, { 
    templateName: "usersPaginate", 
    itemTemplate: "userListItem", 
    router: "iron-router", 
    homeRoute: "/userlist/", 
    route: "/userlist/", 
    routerTemplate: "userListPage", 
    routerLayout: "indexLayout", 
    perPage: 50, 
    sort: {createdAt: -1}, 
    auth: function(skip, sub){ 
     //use alanning:roles 
     if(Roles.userIsInRole(sub.userId, ['admin'])) { // see all users 
      return Meteor.users.find({roles: 'user', user_status: {$in: [1,2,3,4,5]}}, {fields: {services: 0}}); 
     } else if(Roles.userIsInRole(sub.userId, ['manager'])) { // see own users 
      return Meteor.users.find({manager_id: sub.userId, roles: 'user', user_status: {$in: [1,2,3,4,5]}}, {fields: {services: 0}}); 
     } else { 
      console.log('whaa?'); 
      return false ; 
     } 
    }, 
    divWrapper: false, 
    fastRender: true, 
    availableSettings: { 
     filters: true, 
     settings: true 
    } 
}); 

,如果我设置在模板过滤器“user_status”:

Template.usersPaginate.events({ 
    'change #user_status': function(event, template){ //select input 
     var status_id = parseInt(event.currentTarget.value) ; 
     var filter = {} ; 
     if(status_id !== 0) { 
      filter.user_status = status_id ; 
     } 
     //.... 
     UsersPagination.set({ 
      filters: filter 
     }); 
    } 
}); 

它不工作,模板刷新,但过滤器不工作。显示所有用户。 请告诉我我做错了什么。 对不起我的英文不好:)

回答

0

组合验证和过滤器似乎有bug或没有明确记录。做你自己的分页。你会花最少的时间。

+0

如何在同一事件但不同功能的两个视图分页? – Ankita 2015-10-09 05:44:09