Sort by view default only if sort not currently set (#1962)

mine
Niko Janceski 2023-03-16 16:27:44 -04:00 committed by GitHub
parent 6b93085b61
commit ab9f960788
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -204,7 +204,7 @@ func (t *Table) doUpdate(data *render.TableData) {
custData := data.Customize(cols, t.wide)
if t.viewSetting != nil && t.viewSetting.SortColumn != "" {
tokens := strings.Split(t.viewSetting.SortColumn, ":")
if custData.Header.IndexOf(tokens[0], false) >= 0 {
if custData.Header.IndexOf(tokens[0], false) >= 0 && custData.Header.IndexOf(t.sortCol.name, false) < 0 {
t.sortCol.name, t.sortCol.asc = tokens[0], true
if len(tokens) == 2 && tokens[1] == "desc" {
t.sortCol.asc = false