jdcalkins / ng2-data-table

DataTable - Simple table component with sorting, pagination, and row select/multi-select for Angular2
MIT License
7 stars 7 forks source link

default sortby and sortorder #31

Open nagchanda opened 6 years ago

nagchanda commented 6 years ago

Can we please have sortby and sortorder back as inputs.

I have been using angular2-datatable but it is not supported by angular 5. I found this component is forked from it, but missing functionality to accept default sortby and sortorder.

tommytomatoe commented 5 years ago

This is a bit old, but in case someone else might find it helpful.

You can add the following line to set the sortBy and sortOder:

component.ts:

  ngOnIt() {
    this.getData();
    this.mfDataTable.setSort(sortBy, sortOrder);
  }

component.html:

<table [mfData]="datasets | dataFilter: filterQuery" #mf="mfDataTable">