lorenzofox3 / Smart-Table

Code source of Smart Table module: a table/grid for Angularjs
http://lorenzofox3.github.io/smart-table-website/
1.8k stars 513 forks source link

st-sort-default="true" not working when table first loads. #830

Closed trishala1234 closed 4 years ago

trishala1234 commented 6 years ago

Hi,

I am using angular version 1.3.5 Smart table version is 1.4.5

I am using smart table to display data that is received dynamically using ajax call. I wish to sort the table coloumns and am using st-sort for the same. When clicking on the sorting icons, the sorting works correctly, as expected, both ascending and descending order.

However, when the table first loads, the requirement is to sort the coloums in ascending order by default. For this am using st-sort-default="true"

But this does not work. When the table is loaded for the first time, it displays the data in the coloum in natural order(without any sorting).

The below is the piece of code am using

{{column.displayName}}

Could you please help me know what is the issue. Just reiterating, the sorting works correctly when clicking on the sorting icons on the column header.

lorenzofox3 commented 6 years ago

can you please provide a running example? thanks

supervos commented 4 years ago

Are you using the stSafeSrc attribute?

I had the same issues with the first load of the table and using this attribute fixed the issue.