Skip to content

Accessing OnSelected method of Checkbox in a table #31

Closed
@copiesofcopies

Description

@copiesofcopies

I am building a table out of this struct:

type DisplayAccount struct {
    Enabled bool
    Name    string
}

Here is the code:

// Assemble table of accounts
accounts := make([]DisplayAccount, len(config.Accounts))

// Pull accounts from config file
for i, account := range config.Accounts {
    enabled := account.Enabled
    acctName := strings.Join([]string{account.Name, account.Server}, "@")
    accounts[i] = DisplayAccount{enabled, acctName}
}   

// Populate table
accountTable := ui.NewTable(reflect.TypeOf(accounts[0]))
accountTable.Lock()
e := accountTable.Data().(*[]DisplayAccount)
*e = accounts
accountTable.Unlock()

How do I access the OnSelected method of each "Enabled" field in accountTable?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions