MCPcopy Create free account
hub / github.com/cogentcore/core / setSortFieldName

Method setSortFieldName

core/table.go:445–469  ·  view source on GitHub ↗

setSortFieldName sets sorting to happen on given field and direction see [Table.sortFieldName] for details.

(nm string)

Source from the content-addressed store, hash-verified

443// setSortFieldName sets sorting to happen on given field and direction
444// see [Table.sortFieldName] for details.
445func (tb *Table) setSortFieldName(nm string) {
446 if nm == "" {
447 return
448 }
449 spnm := strings.Split(nm, ":")
450 got := false
451 for fli := 0; fli < tb.numVisibleFields; fli++ {
452 fld := tb.visibleFields[fli]
453 if fld.Name == spnm[0] {
454 got = true
455 // fmt.Println("sorting on:", fld.Name, fli, "from:", nm)
456 tb.sortIndex = fli
457 }
458 }
459 if len(spnm) == 2 {
460 if spnm[1] == "down" {
461 tb.sortDescending = true
462 } else {
463 tb.sortDescending = false
464 }
465 }
466 if got {
467 tb.SortSlice()
468 }
469}
470
471// RowGrabFocus grabs the focus for the first focusable widget in given row;
472// returns that element or nil if not successful. Note: grid must have

Callers 1

makeFilesRowMethod · 0.80

Implementers 1

_cogentcore_org_core_plot_plots_Tableyaegicore/symbols/cogentcore_org-core-

Calls 2

SortSliceMethod · 0.95
SplitMethod · 0.80

Tested by

no test coverage detected