Mat Sort Header Not Working

Because that is a common problem as when the template is rendered because of the ngif matsort is undefined.
Mat sort header not working. In this chapter we will showcase the configuration required to show a sort header using angular material. Following is the content of the modified module descriptor app module ts. It s when i use a md tab and if my md table is not in the first tab loaded on the load of the page the initialization of arrow is bad. As indicated the reference table must have a 1 1 relationship with the data in the table you want to sort.
Are you sure your second table the one where sort is not working is not wrapped in a div with ngif. Mat sort header to be working when including row definitions via ng content. The mat header row component and the matheaderrowdef directive. The mat sort header and matsort an angular directives are used to add sorting capability to a table header.
Using a custom data source any sorting must be done based on some property of the data itself. The first can be done simply by using the table header to sort the table. Angular 5 material data table sorting not working. In my case sorting was not working because matcolumdef id and mat cell var is different.
Share follow edited apr. The second is an option to sort a visual by a column on a reference table. Here is how to fix it. This combination of related component directive works in the following way.
Good try but i think it s not the problem. When using the mattabledatasource vs. In fact i found something interesting. Sorry i didn t have the time to do a plunker now if you don t understand i will try to do it begining with yours but the idea is something like that.
The mat header row on the other hand applies some minimal material stying. Bug feature request or proposal. By default the sort header uses the column name as a key to the data. In your example the data does not have a position property.
The reason why i want to group the two columns under 1 container is that if i hide some of the columns and the mat table is reloaded the column width adjustment will not affect the parent and sub headers position.