MCPcopy
hub / github.com/g3n/engine / insertRow

Method insertRow

gui/table.go:690–718  ·  view source on GitHub ↗

insertRow is the internal version of InsertRow which does not call recalc()

(row int, values map[string]interface{})

Source from the content-addressed store, hash-verified

688
689// insertRow is the internal version of InsertRow which does not call recalc()
690func (t *Table) insertRow(row int, values map[string]interface{}) {
691
692 // Creates tableRow panel
693 trow := new(tableRow)
694 trow.Initialize(trow, 0, 0)
695 trow.cells = make([]*tableCell, 0)
696 for ci := 0; ci < len(t.header.cols); ci++ {
697 // Creates tableRow cell panel
698 cell := new(tableCell)
699 cell.Initialize(cell, 0, 0)
700 cell.label.initialize("", StyleDefault().Font)
701 cell.Add(&cell.label)
702 trow.cells = append(trow.cells, cell)
703 trow.Panel.Add(cell)
704 }
705 t.Panel.Add(trow)
706
707 // Inserts tableRow in the table rows at the specified index
708 t.rows = append(t.rows, nil)
709 copy(t.rows[row+1:], t.rows[row:])
710 t.rows[row] = trow
711 t.updateRowStyle(row)
712
713 // Sets the new row values from the specified map
714 if values != nil {
715 t.SetRow(row, values)
716 }
717 t.recalcRow(row)
718}
719
720// ScrollDown scrolls the table the specified number of rows down if possible
721func (t *Table) scrollDown(n int) {

Callers 2

SetRowsMethod · 0.95
InsertRowMethod · 0.95

Calls 7

updateRowStyleMethod · 0.95
SetRowMethod · 0.95
recalcRowMethod · 0.95
StyleDefaultFunction · 0.85
InitializeMethod · 0.45
initializeMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected