I remember that BootstarpTable has a property that can set the sorting of column aliases according to the sorting of aliases. But I failed to find two articles on CSDN for a day. To be exact, one article is forwarded, and to solve this problem, I felt it was written in a mess after reading it A few lines of code that solve themselves in a different way are straightforward
Before the change
Select * from table_name where createTime (' createTime ', 'createTime', 'createTime')
{
field: 'createTime'.title: 'Entry time'.sortable: true
},
Copy the code
Solution: the value of field is the value of the database sort field where c is the table alias if you do not have an alias can be directly ‘table name’. The field name ‘
Row: represents the current column row. CreateTime is what I want to display. Be careful not to return value directly
{
field: 'c.createTime'.title: 'Entry time'.sortable: true.formatter: function (value, row, index) {
returnrow.createTime; }},Copy the code