Open Closed

Multiple ngx-datables #328


User avatar
0
ninomartini created
  • ABP Framework version: v3.04
  • UI type: Angular

I can't figure out how to use two or more ngx-datatables on the same page using the ListService.

Table 1: ngx-datatable [rows]="data.items" [count]="data.totalCount" [list]="list" default>

Table 2: <ngx-datatable [rows]="dataMessages.items" [count]="dataMessages.totalCount" [list]="list" default>

Going to page 2 on one table causes the other table to also go to page two. How do I break this synchronization?


1 Answer(s)
  • User Avatar
    2
    ninomartini created

    Solved by creating a factory function.

      providers: [
        { provide: 'list', useClass: ListService },
        { provide: 'unitMessageList', useClass: ListService },
        ...]
        
      constructor(
        @Inject('list') public readonly list: ListService,
        @Inject('unitMessageList') public readonly unitMessageList: ListService,
        ...
        }
    
Made with ❤️ on ABP v9.1.0-preview. Updated on November 11, 2024, 11:11