MCPcopy Index your code
hub / github.com/g3n/engine / SortColumn

Method SortColumn

gui/table.go:644–661  ·  view source on GitHub ↗

SortColumn sorts the specified column interpreting its values as strings or numbers and sorting in ascending or descending order. This sorting is independent of the sort configuration of column set when the table was created

(col string, asString bool, asc bool)

Source from the content-addressed store, hash-verified

642// and sorting in ascending or descending order.
643// This sorting is independent of the sort configuration of column set when the table was created
644func (t *Table) SortColumn(col string, asString bool, asc bool) {
645
646 c := t.header.cmap[col]
647 if c == nil {
648 panic(tableErrInvCol)
649 }
650 if len(t.rows) < 2 {
651 return
652 }
653 if asString {
654 ts := tableSortString{rows: t.rows, col: c.order, asc: asc, format: c.format}
655 sort.Sort(ts)
656 } else {
657 ts := tableSortNumber{rows: t.rows, col: c.order, asc: asc}
658 sort.Sort(ts)
659 }
660 t.recalc()
661}
662
663// setRow sets the value of all the cells of the specified row from
664// the specified map indexed by column id.

Callers 1

onRiconMethod · 0.95

Calls 1

recalcMethod · 0.95

Tested by

no test coverage detected