data_table_action.go 436 B

123456789101112131415161718192021
  1. package builder
  2. type DataTableActionRow struct {
  3. Icon string
  4. Href string
  5. Hint string
  6. Target string
  7. }
  8. func DataTableAction(data *[]DataTableActionRow) string {
  9. result := ``
  10. for _, row := range *data {
  11. target := ``
  12. if row.Target != "" {
  13. target = ` target="` + row.Target + `"`
  14. }
  15. result += `<a class="ico" title="` + row.Hint + `" href="` +
  16. row.Href + `"` + target + `>` + row.Icon + `</a>`
  17. }
  18. return result
  19. }