src/components/table/helpers/mixin-sorting.js
// Need to move from thead-mixin
Need to move from thead-mixin
Need to move from thead - mixin
handleSort(key, field, evt, isFoot) {
      if (!this.isSortable) {
        return
      }
      if (isFoot && this.noFooterSorting) {
        return
      }
      let sortChanged = false
      const toggleLocalSortDesc = () => {
        const sortDirection = field.sortDirection || this.sortDirection
        if (sortDirection === 'asc') {
          this.localSortDesc = false
        } else if (sortDirection === 'desc') {
          this.localSortDesc = true
        } else {
        }
      }
      if (field.sortable) {
        if (key === this.localSortBy) {
          this.localSortDesc = !this.localSortDesc
        } else {
          this.localSortBy = key
          toggleLocalSortDesc()
        }
        sortChanged = true
      } else if (this.localSortBy && !this.noSortReset) {
        this.localSortBy = ''
        toggleLocalSortDesc()
        sortChanged = true
      }
      if (sortChanged) {
        this.$emit('sort-changed', this.context)
      }
    }
handleSort ( key , field , evt , isFoot ) { if ( ! this . isSortable ) { return } if ( isFoot && this . noFooterSorting ) { return } let sortChanged = false const toggleLocalSortDesc = ( ) => { const sortDirection = field . sortDirection || this . sortDirection if ( sortDirection === 'asc' ) { this . localSortDesc = false } else if ( sortDirection === 'desc' ) { this . localSortDesc = true } else { } } if ( field . sortable ) { if ( key === this . localSortBy ) { this . localSortDesc = ! this . localSortDesc } else { this . localSortBy = key toggleLocalSortDesc ( ) } sortChanged = true } else if ( this . localSortBy && ! this . noSortReset ) { this . localSortBy = '' toggleLocalSortDesc ( ) sortChanged = true } if ( sortChanged ) { this . $emit ( 'sort-changed' , this . context ) } }
Need to move from thead-mixin
Need to move from thead - mixin
/* istanbul ignore next */ // TODO: make this tri-state sorting // cycle desc => asc => none => desc => ... // sortDirection === 'last' // Leave at last sort direction from previous column // Change sorting direction on current column // Start sorting this column ascending // this.localSortDesc = false // Sorting parameters changed