When the datatable is in normal mode, the default sorting is applied and visible in the table header. When switching to mobile view, the columns are replaced by one column and a dropdown is added for sorting. I expect the default value of the dropdown to be set to the column and sorting mode that is currently applied to the datatable.
The sorting is still correct, but the selected dropdown value is set to the first value instead of the actual value and sorting mode currently applied.
Load attached page and bean in normal view. Notice the default sorting is set correctly to lastname . Switch to mobile view. The dropdown is set to First name ascending, but the applied sorting is still last name. When you switch back to normal view the sorting is still lastname.
Attached file incorrectsorting.xhtml
Attached file IncorrectSortingBean.java and Staff.java