Coder Social home page Coder Social logo

ngx-multi-sort-table's Introduction

NgxMultiSortTable

This is the implementation for a multiple sortable table based on the Angular Material Design. The focus is on server-side loaded and sorted data. Next to that, the library provides some useful classes to reduce the duplicated code when using the material paginator. The code is based on Francisco Arantes Rodrigues repository repo, so thanks for your great work.


Warning:

  • Older versions might have known security issues. So keep up-to-date!
  • Older versions of this library lack some features.

Demo

Visit the GitHub pages demo or clone and run it locally.

To run the demo:

  1. clone the repository
  2. npm install
  3. ng build mat-multi-sort

demo gif

Changelog

See the GitHub release notes.

Documentation

TableData

The TableData a useful class, which handles a lot of work for your app, such as page events (next, previous, sizeChange) and sorting events. Next to that, it keeps the current state of the table, again sorting and pagination.

Properties

Name Description default Example
columns An array of the displayed columns of the table with id: name of the attribute and name: Name to display in the header none [{ id: 'first_name', name: 'First Name' }]
displayedColumns An array of the currently displayed columns (id) and their order all columns
dataSource A MatMultiSortTableDataSource, which is special DataSource for sorting. Only accesable via getter and setter none
data The table data of the dataSource Array<T>
pageSize The current selected pageSize first entry of pageSizeOptions
pageSizeOptions The options for the pageSize, which the user can see in the menu [10, 20, 50, 100]
pageIndex The index of the page 0
totalElements The total number of elements of the table, must be set from your component none
sortParams An Array of the columns (id), which the user had chosen to sort. The order of the sorting is represented by the order of the ids in the parameter [] ['first_name', 'last_name']
sortDirs An Array of the column's sort-directions, which the user had chosen to sort. The order is the same like sortParams [] ['asc', 'desc']
nextObservable An Observable that fires, when the user clicks the next button
previousObservable An Observable that fires, when the user clicks the previous button
sizeObservable An Observable that fires, when the user changes the pageSize
sortObservable An Observable that fires, when the user changes the sorted columns or direction

Methods

Name Description Parameter
constructor The constructor for the for the class, where you initialize your columns. Optionally, you can add the default ids of the default sort colum and direction. If defaultSortParams are provided, but not the directions asc will be default columns: Array<{ id: string, name: string }>, options: { defaultSortParams?: string[], defaultSortDirs?: string[], pageSizeOptions?: number[], totalElements?: number }
onSortEvent The method to bind to the matSortChange output of the table none
onPaginationEvent The method to bin to the page output of the mat-paginator $event: PageEvent
updateSortHeaders The method triggers a rerendering of the headers to show the sorting directions correctly. The functions forces a complete new render of the data, what is not optimal, but only working solution right now. none
updateColumnNames The method allows you to change the displayed name of the columns { id: string, name: string }[]
localStorageKey A key to store the table settings, like selected columns, order of the columns, sorting directions in the local storage. If no key is passed the settings are not stored. Do not set the same key for different tables, this might lead to unexpected behavior. There is an validation of the loaded settings, if that fails, the defaults are used string

MatMultiSortHeaderComponent

This component manages the sorting of the table. To use the multi-sort add matMultiSort to your table and pass the mat-multi-sort-header="<your-column-id>" to the <th mat-header-cell>.

MatMultiSortTableSettingsComponent

This component display some settings for your table. The user can select the columns he wants to see in his table, next to that he can change the order of the columns. Additionally, the component shows the current chosen sorting columns as chips above the table. The user can easyly change the sorting order by drag and drop the chips and also change the sorting direction of each column.

Name Description Parameter
tableData An input of tableData object which holds the complete table state @Input: TableData
sortToolTip A input test for the tooltip to show up over the sorting chips @Input: string
closeDialogOnChoice A input to control the behavior of the settings menu. If set to true the dialog closes after the user has selected a column, if false it stays open, so the user can select/deselect multiple columns with out reopening the dialog. @Input: boolean
scrollStrategy An input of ScrollStrategy for the CDK overlay. Sets the behavior for scrolling when the dialog is opened. Possible options are the predefined strategies: Noop, Close, Block or Reposition, with Block being the default value. @Input: ScrollStrategy

MatMultiSortTableDataSource

This is the datasource of the MultiSortTable, it works like the MatTableDataSource´.

Name Description Parameter
constructor The constructor of the class sort: MatMultiSort, clientSideSorting: boolean = false

Example code for the template

<mat-multi-sort-table-settings [tableData]="table" sortToolTip="Sortierreihenfole ändern"  [closeDialogOnChoice]="false">
  <button mat-stroked-button>
    Spalten bearbeiten &nbsp;
    <mat-icon>menu</mat-icon>
  </button>
  <!-- Optional custom content for the sort indicator chip (here column name with icons)  --> 
  <ng-template #sortIndicator let-direction='direction' let-columnName='columnName'>
    {{columnName}}
    <mat-icon *ngIf="direction">{{direction === 'asc' ? 'arrow_upward' : 'arrow_downward'}}</mat-icon>
  </ng-template>
</mat-multi-sort-table-settings>
<table mat-table [dataSource]="table.dataSource" matMultiSort (matSortChange)="table.onSortEvent()">

    <!-- Create all your columns with *ngfor, this is the lazy way out and only works if the display of the data does not differ -->
    <ng-container *ngFor="let column of table.columns" [matColumnDef]="column.id">
      <th mat-header-cell *matHeaderCellDef [mat-multi-sort-header]="column.id"> {{column.name}} </th>
      <td mat-cell *matCellDef="let row"> {{row[column.id]}} </td>
    </ng-container>

    <!-- Or define your in a normal, more individuell way -->
    <ng-container matColumnDef="id">
      <th mat-header-cell *matHeaderCellDef mat-multi-sort-header="id"> ID </th>
      <td mat-cell *matCellDef="let row"> {{row.id}} </td>
    </ng-container>

    <ng-container matColumnDef="progress">
      <th mat-header-cell *matHeaderCellDef mat-multi-sort-header="progress"> Progress </th>
      <td mat-cell *matCellDef="let row"> {{row.progress}} % </td>
    </ng-container>

    <ng-container matColumnDef="name">
      <th mat-header-cell *matHeaderCellDef mat-multi-sort-header="name"> Name </th>
      <td mat-cell *matCellDef="let row"> {{row.name}} </td>
    </ng-container>

  <tr mat-header-row *matHeaderRowDef="table.displayedColumns"></tr>
  <tr mat-row *matRowDef="let row; columns: table.displayedColumns;">
  </tr>
</table>
<mat-paginator [pageSize]="table.pageSize" [pageIndex]="table.pageIndex" [pageSizeOptions]="table.pageSizeOptions"
  [length]="table.totalElements ? table.totalElements : 0" (page)="table.onPaginationEvent($event)" [disabled]="CLIENT_SIDE">
</mat-paginator>

Example code for the component.ts

export class AppComponent implements OnInit {
  CLIENT_SIDE = true;

  table: TableData<UserData>;
  @ViewChild(MatMultiSort, { static: false }) sort: MatMultiSort;

  constructor(
    private dummyService: DummyService
  ) {
    this.table = new TableData<UserData>(
      [
        { id: 'id', name: 'ID' },
        { id: 'name', name: 'Name' },
        { id: 'progress', name: 'Progess' }
      ], { localStorageKey: 'settings' }
    );
  }

  ngOnInit() {
    this.table.nextObservable.subscribe(() => { this.getData(); });
    this.table.sortObservable.subscribe(() => { this.getData(); });
    this.table.previousObservable.subscribe(() => { this.getData(); });
    this.table.sizeObservable.subscribe(() => { this.getData(); });

    setTimeout(() => {
      this.initData();
    }, 0);
  }

  initData() {
    this.table.dataSource = new MatMultiSortTableDataSource(this.sort, this.CLIENT_SIDE);
    if (this.CLIENT_SIDE) {
      this.getOfflineData();
    } else {
      this.table.pageSize = 10;
      this.getData();
    }
  }

  getData() {
    if (!this.CLIENT_SIDE) {
      const res = this.dummyService.list(this.table.sortParams, this.table.sortDirs, this.table.pageIndex, this.table.pageSize);
      this.table.totalElements = res.totalElements;
      this.table.pageIndex = res.page;
      this.table.pageSize = res.pagesize;
      this.table.data = res.users;
    }
  }

  getOfflineData() {
    const res = this.dummyService.list([], [], 0, 25);
    this.table.totalElements = 25;
    this.table.pageIndex = res.page;
    this.table.pageSize = res.pagesize;
    this.table.data = res.users;
  }
}

Contributing

How should I write my commits?

Release Please assume you are using Conventional Commit messages.

The most important prefixes you should have in mind are:

  • fix: which represents bug fixes, and correlates to a SemVer patch.
  • feat: which represents a new feature, and correlates to a SemVer minor.
  • feat!:, or fix!:, refactor!:, etc., which represent a breaking change (indicated by the !) and will result in a SemVer major.

ngx-multi-sort-table's People

Contributors

anthbs avatar bsongis avatar catscratch avatar dafnik avatar dependabot[bot] avatar forbik0 avatar github-actions[bot] avatar hellysonrp avatar lotec724 avatar maxl94 avatar mosamman avatar ruempel avatar slasherzet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ngx-multi-sort-table's Issues

defaultSortParams constructor parameter can't be used.

defaultSortParams can't be put as option in the TableData constructor call since it triggers the testing of _displayedColumns which haven't been set at that stage.

if (options.defaultSortParams) { options.defaultSortParams.map(s => { if (!this._displayedColumns.includes(s)) { throw Error('Provided sort parameter "${s}" is not a column.'); } }); }

Sorting event handling

Hello! I'm trying to use multi sort for my table, but I can't get a grip on event handling for sort change for some reason. Here's an example of my code: https://stackblitz.com/edit/angular-vf7brq-3ymnui?devToolsHeight=33&file=src/app/table-sorting-example.html

Clicking on the column headers doesn't trigger anything and I'm wondering how much of the event handling I should implement.

Note: I noticed the same thing about the original Stackblitz example for this package. Clicking on the column headers doesn't do any sorting the way the GIF shows. Pagination, however, seems fine.

Angular 8, ngx-mat-multi-sort 0.7.4.

Thanks!

update sort if columns change

  1. selecte mulits columns for sorting
  2. remove one of these columns
  3. sorting is not updated, the previous columns a show

change hover for sorting chips

I want as user to see a "click" cursor when I hover the sorting direction, so I know I can change it. Also the tool tip should only show up than.

If subset of columns is displayed by default, column selection menu still shows the column as selected

If I want to display a subset of the columns and add this line to your demo's app.component.ts:initData():43...

    this.table.displayedColumns = ['id', 'progress']

and run the project, I will see this in the Spalten bearbeiten menu...
image

You'll notice the Name column in the checklist is checked even though it is not currently displayed. I would expect it to be unchecked because that column was programmatically hidden in initData().

When the TableData class is initialized, it should set each column.active to false if that column is in the array of displayedColumns (but does not currently).

The problem occurs here. There's a setter for displayedColumns but it doesn't update the column.active property.

DisplayedColumns are not correctly set when loading settings

I tried the following TableData initialization.

const columns = [{ id: 'C1', name: 'Name1' }, { id:'C2', name: 'Name2' }]; 
const table = new TableData(columns, { localStorageKey: 'myKey' });
console.log(table.columns, table.displayedColumns);

On the initial call the output looks like this.
For columns:

[{ id: 'C1', name: 'Name1', isActive: true }, { id:'C2', name: 'Name2', isActive: true }]

For displayedColumns:

[ 'C1', 'C2' ]

Then I hide column 'C2' in the UI and the settings are stored to the local storage:

MyKey._columns: [{ id: 'C1', name: 'Name1', isActive: true }, { id:'C2', name: 'Name2', isActive: false }]

Looks good. Now when the constructor is called again, the column is still in the displayedColumns.
Same constructor call (without any 'isActive').

For columns:

[{ id: 'C1', name: 'Name1', isActive: true }, { id:'C2', name: 'Name2', isActive: false }]

For displayedColumns:

[ 'C1', 'C2' ]

So, the right data is loaded into columns, but somehow overridden in displayedColumns. Seems like this could be a timing issue with the BehaviorSubject in the init function.

My temporary workaround is, to set the displayedColumns manually, directly after calling the constructor of TableData.

const columns = [{ id: 'C1', name: 'Name1' }, { id:'C2', name: 'Name2' }]; 
const table = new TableData(columns, { localStorageKey: 'myKey' });
table.displayedColumns = table.columns
      .filter(column => column.isActive)
      .map(column => column.id);

column-dialog can be outside of view, making items unreachable

Hello again,

I found an issue with the mat-dialog positioning implementation. If there are many entries in the column-list, some of them might not fit inside the viewport. However you can't scroll to these items either, because that's how mat-dialog is implemented. The same problem occurs if there is some content above the button, leaving not enough space in the viewport below to show all the items and again you can't scroll anymore. I made a branch in my fork with the first two commits showcasing the problem: https://github.com/Lotec724/ngx-multi-sort-table/tree/overlay You can also see it in the attached gif.
GIF 22-06-2021 18-45-00

The third commit is my proposed change to fix this issue. I decided to replace the mat-dialog with a CDK Overlay (thereby moving the functionality back into the settings.component). The overlay supports passing a positionStrategy in the constructor, which is handling exactly this problem. Otherwise it works pretty much the same. I decided to define a max-height of 70vh for the list, so a scrollbar appears inside the list if it gets too big. I also refactored some css properties to give them more intuitive names.

If you need any more info or would like to discuss the issue, let me know :)

OnChange Observable

Add a onChange() Observable to the TableData Class to give the user a possibility to subscribe all events within one callback.

Fix README

  • add changelog
  • update angular version in table

Stop menu from closing on column toggle

Hello,

I would like to discuss the issue of the column select dropdown closing on every toggle. When a user tries to toggle many columns at once this becomes quite tedious, as he has to reopen the mat-menu for every column. I did some experimenting and found a working solution by adding a (click)="$event.stopPropagation()" to the "example-box" divs in the mat-multi-sort-table-settings.component.html:25.

<div class="example-box" *ngFor="let column of _tableData.columns" cdkDrag (click)="$event.stopPropagation()">

This might not be the preferred behavior for everyone, so it would probably be a better idea to provide an optional @input to set this behaviour. Let me know what you think and I will gladly provide a PR if needed.

Settings dialog position bug

Hi,
I found problem with positioning of dialog window with column settings. If the mat-multi-sort-table-settings is placed in some nested element which has position relative/absolute, the dialog is opened on incorrect position.
Functions offsetTop and offsetTop are used in openDialog function. But offset function takes relative position to parent element. Fix is simple, replace two lines:
const posRight: number = window.innerWidth - (button.offsetLeft + button.offsetWidth + 16);
const posTop: number = button.offsetTop + button.offsetHeight;
by this one:
const posRight: number = window.innerWidth - (button.getBoundingClientRect().left + button.offsetWidth + 16);
const posTop: number = button.getBoundingClientRect().top + button.offsetHeight;

I have new branch with the fix locally, so if you give me access, I can create a pull request.

PS: I really like this library, thank you for you work.

MatSearch

Material search filter not working in MatMultiSortTableDataSource

Angular 9 compatibility issue

Angular 9 uses the Ivy compiler per default which makes using ngx-multi-sort-table problematic.

The error :

ERROR in Failed to compile entry-point ngx-mat-multi-sort (module as esm5) due to compilation errors:
node_modules/ngx-mat-multi-sort/fesm5/ngx-mat-multi-sort.js:924:30 - error NG1010: Value at position 1 in the NgModule.imports of MatMultiSortModule is not a reference: [object Object]

924                     imports: [
                                 ~
925                         CommonModule,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
... 
935                         MatTooltipModule
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
936                     ]
    ~~~~~~~~~~~~~~~~~~~~~

_handleClick being called twice

MatMultiSortHeaderComponent _handleClick is being called twice: one for the host of the MatSortHeader and another for the _handleClick HostListener decorator.

This behavior is related to this change in Angular.

Screenshot_2

Screenshot_3

AFAIK you can safely remove the HostListener from the MatMultiSortHeaderComponent, but I'm not certain.

Angular CLI version: 10.2.0
Angular version: 10.1.7

Cannot read property 'length' of undefined

I'm getting this error: Cannot read property 'length' of undefined and I can't figured if it's a bug of your library or not. I created some dummy data just to insert on the this.table.data but the apps crashes (I think) when initializing the dataService.

...
import { MatMultiSort, TableData, MatMultiSortTableDataSource } from 'ngx-mat-multi-sort';
...

interface User {
  name: string,
  username: string,
  email: string,
  supplier: string,
  country: string,
  firstLoginDate: Date,
  lastLoginDate: Date,
  numberOfLogins: number,
  login: boolean,
  role: string,
  welcomeEmail?: boolean,
  serviceManagementRoles: Array<string>,
  teams: Array<string>
}
...
export class UserComponent implements OnInit {
    ...
    table: TableData<User>;
    ...

    @ViewChild(MatMultiSort, {static: false}) sort: MatMultiSort;

     constructor(){
        this.table = new TableData<User>(
          [
             {id: 'actions', name: 'Actions'},
             {id: 'name', name: 'Name'},
             {id: 'username', name: 'Username'},
             {id: 'email', name: 'Email'},
             {id: 'country', name: 'Country'},
             {id: 'supplier', name: 'Supplier'},
             {id: 'firstLoginDate', name: 'First Login Date'},
             {id: 'lastLoginDate', name: 'Last Login Date'},
             {id: 'numberOfLogins', name: 'Number of Logins'},
             {id: 'login', name: 'Login'},
             {id: 'role', name: 'Role'},
             {id: 'welcomeEmail', name: 'Welcome Email'},
         ]
       )
     }

    ngOnInit() {
      setTimeout(() => {
         this.initData();
      }, 0);
    }

   initData(){
     this.table.dataSource = new MatMultiSortTableDataSource(this.sort, false); //I think the app crashes here because there is no logs in the console
     console.log("initData");
     this.getData();
   }

  getData(){
    console.log("getData");
    const data: User[] = [
      {name: "admin", username: "admin", email: "[email protected]", country: "Portugal", supplier: "Teste1", firstLoginDate: new Date("2020-03-05T00:00:00"), lastLoginDate: new Date("2020-03-05T00:00:00"), numberOfLogins: 3, login: true, role: "Administrator", welcomeEmail: true, serviceManagementRoles: ["Team", "Leaders"], teams: ["TEAM 001", "TEAM 002"]},
      {name: "cliente", username: "cliente", email: "[email protected]", country: "Espanha" ,supplier: "Teste2", firstLoginDate: new Date("2020-03-05T00:00:00"), lastLoginDate: new Date("2020-03-05T00:00:00"), numberOfLogins: 5, login: true, role: "Manager", welcomeEmail: true, serviceManagementRoles: ["Team", "Leaders"], teams: ["TEAM 001", "TEAM 002"]}
    ]
    this.table.data = data;
  }
}
<table mat-table [dataSource]="table.dataSource" matMultiSort (matSortChange)="table.onSortEvent()">
        <ng-container matColumnDef="actions">
          <th mat-header-cell *matHeaderCellDef></th>
          <td mat-cell *matCellDef="let element">
            <button mat-icon-button (click)="openDialog('Edit', element)"><mat-icon>edit</mat-icon></button>
            <button mat-icon-button color="warn" (click)="deleteUser(element)"><mat-icon>delete</mat-icon></button>
          </td>
        </ng-container>
  
        <ng-container matColumnDef="name">
          <th mat-header-cell *matHeaderCellDef mat-multi-sort-header="name"> Name </th>
          <td mat-cell *matCellDef="let element"> {{element.name}} </td>
        </ng-container>

        <ng-container matColumnDef="username">
          <th mat-header-cell *matHeaderCellDef mat-multi-sort-header="username"> Username </th>
          <td mat-cell *matCellDef="let element"> {{element.username}} </td>
        </ng-container>
      
        <ng-container matColumnDef="email">
          <th mat-header-cell *matHeaderCellDef mat-multi-sort-header="email"> Email </th>
          <td mat-cell *matCellDef="let element"> {{element.email}} </td>
        </ng-container>
      
        <ng-container matColumnDef="country">
          <th mat-header-cell *matHeaderCellDef mat-multi-sort-header="country"> Country </th>
          <td mat-cell *matCellDef="let element"> {{element.country}} </td>
        </ng-container>
      
        <ng-container matColumnDef="supplier">
          <th mat-header-cell *matHeaderCellDef mat-multi-sort-header="supplier"> Supplier </th>
          <td mat-cell *matCellDef="let element"> {{element.supplier}} </td>
        </ng-container>
      
        <ng-container matColumnDef="firstLoginDate">
          <th mat-header-cell *matHeaderCellDef mat-multi-sort-header="firstLoginDate"> First Login Date </th>
          <td mat-cell *matCellDef="let element"> {{element.firstLoginDate | date:'dd/MM/yyyy HH:mm'}} </td>
        </ng-container>
      
        <ng-container matColumnDef="lastLoginDate">
          <th mat-header-cell *matHeaderCellDef mat-multi-sort-header="lastLoginDate"> Last Login Date </th>
          <td mat-cell *matCellDef="let element"> {{element.lastLoginDate  | date:'dd/MM/yyyy HH:mm'}} </td>
        </ng-container>
        
        <ng-container matColumnDef="numberOfLogins">
          <th mat-header-cell *matHeaderCellDef mat-multi-sort-header="numberOfLogins"> Number of Logins </th>
          <td mat-cell *matCellDef="let element"> {{element.numberOfLogins}} </td>
        </ng-container>
      
        <ng-container matColumnDef="login">
          <th mat-header-cell *matHeaderCellDef mat-multi-sort-header="login"> Login Enabled </th>
          <td mat-cell *matCellDef="let element">
            <ng-container *ngIf="element.login === true">
              <mat-icon color="accent">check</mat-icon>
            </ng-container>
            <ng-container *ngIf="element.login === false">
              <mat-icon color="warn">clear</mat-icon>
            </ng-container>
          </td>
        </ng-container>
      
        <ng-container matColumnDef="role">
          <th mat-header-cell *matHeaderCellDef mat-multi-sort-header="role"> Role </th>
          <td mat-cell *matCellDef="let element"> {{element.role}} </td>
        </ng-container>
      
        <ng-container matColumnDef="welcomeEmail">
          <th mat-header-cell *matHeaderCellDef mat-multi-sort-header="welcomeEmail"> Welcome Email </th>
          <td mat-cell *matCellDef="let element">
            <ng-container *ngIf="element.welcomeEmail === true">
              <mat-icon color="accent">check</mat-icon>
            </ng-container>
            <ng-container *ngIf="element.welcomeEmail === false">
              <mat-icon color="warn">clear</mat-icon>
            </ng-container>
          </td>
        </ng-container>
  
        <tr mat-header-row *matHeaderRowDef="table.displayedColumns"></tr>
        <tr mat-row *matRowDef="let row; columns: table.displayedColumns;"></tr>
      </table>

Output:
Screenshot_4

Does not appear any log (initData and getData)

Hope you help me. Thanks in advance.

Update Angular dependencies to v16

Hey there!

Thanks for all your work publishing this package. It's extremely useful for us! Therefor, we would really appreciate an update to the latest angular releases.

Thanks in advance!

Fix public-apis

The mat-multi-sort-table-settings is not listed in the public_apis, it should be.

Feature requests, API changes or bug fixes

Hello together,

since this library starts gaining popularity, I like to know what should be improved in the next updates. In this thread features, bug fixes and API changes will be discussed.

Thanks for your feedback.

Angular 15 Update Peer Dependencies

First of all, thank you for your package and work!

May I kindly ask you to update your npm package to Angular 15 since your package is the only one not yet supported in my package list.

Error while resolving [email protected] for Angular 15.1.2

npm i is running with an error

npm ERR! While resolving: [email protected]
npm ERR! Found: @angular/[email protected]
npm ERR! node_modules/@angular/cdk
npm ERR! @angular/cdk@"^15.1.2" from the root project
npm ERR! peer @angular/cdk@"15.1.2" from @angular/[email protected]
npm ERR! node_modules/@angular/material
npm ERR! @angular/material@"^15.1.2" from the root project
npm ERR! peer @angular/material@"15.1.2" from @angular/[email protected]
npm ERR! node_modules/@angular/material-moment-adapter
npm ERR! @angular/material-moment-adapter@"^15.1.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/cdk@"~15.0.4" from [email protected]
npm ERR! node_modules/ngx-mat-multi-sort
npm ERR! ngx-mat-multi-sort@"^0.10.1" from the root project

Refactor Package

  • Add Action for automated releases
  • Update docs
    • Contribution Guidelines
  • Sync Version with Angular

Clear Sort Items

  • clear all sort columns

  • remove just one column from sorting

  • reorder sorting columns with drag and drop

Inital arrows

Hi!

I couldn't achieve that on init the table the arrows are shown for the appropriate directions. Only the numbers are shown. Do you have an example for that?

Change constructor

Change constructor to set the totalElements by the setTableData function

Add filtering to MatTableDataSource

filtering is present in MatTableDataSource and not in DataSource. Basically, for filtering any data we will use below logic with MatTableDataSource ..

searchText :"" --> we get this input from html on a key stroke on search field

dataSource: MatTableDataSource;

this.dataSource.filter === searchText

now the dataSource will have the filtered value and the same is returned to html

Originally posted by @Rakshith-hv in #33 (comment)

update docs

Update the documentation for the new setter / getter api

Request for adding support of custom content in the chip list (Icons instead of "asc | desc" labels for example)

Hello Max,

first of all thank you for this awesome implementaion of multi-sorting. I am really enjoying it, however I have the case that I need to replace the labels in the chip list into icons (see attached example).

I am gonna create a pull request for this new feature, which will allow replacing anything desitred in the place of the column name and the direction indicator. I hope you woudn't mind accepting it.

Best Regards,
khalilof
icon-indicators

Check Type of sortParams and sortDirs

It should not possible to set the sortParams and sortDirs to something other than a Array, if null or undefined throw error or convert to empty array.

Current Workaround:
Never set sortParams or sortDirs to null or undefined, always provied an array. An empty array is okay.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.