Commits

Daniel Poelzleithner committed 6e08067

allow disabled records in select widget

this allows the use record entries as seperators

  • Participants
  • Parent commits 0b7e87f

Comments (0)

Files changed (1)

File framework/env/ui/field/select.lua

 --[[--
 ui.field.select{
   ...                                 -- generic ui.field.* arguments, as described for ui.autofield{...}
-  foreign_records = foreign_records,  -- list of records to be chosen from, or function returning such a list
-  foreign_id      = foreign_id,       -- name of id field in foreign records
-  foreign_name    = foreign_name,     -- name of field to be used as name in foreign records
-  format_options  = format_options    -- format options for format.string
+  foreign_records  = foreign_records,  -- list of records to be chosen from, or function returning such a list
+  foreign_id       = foreign_id,       -- name of id field in foreign records
+  foreign_name     = foreign_name,     -- name of field to be used as name in foreign records
+  format_options   = format_options    -- format options for format.string
+  disabled_records = disabled_list     -- table of record keys that should be disabled
 }
 
 This function inserts a select field in the active slot. For description of the generic field helper arguments, see help for ui.autofield{...}.
               tag     = "option",
               attr    = {
                 value    = key,
+                disabled = ((args.disabled_records and args.disabled_records[key] and "1" ) or nil),
                 selected = ((key == args.value) and "selected" or nil)
               },
               content = format.string(