webmcp

changeset 30:6e08067e66c1

allow disabled records in select widget

this allows the use record entries as seperators
author Daniel Poelzleithner <poelzi@poelzi.org>
date Mon Sep 20 20:11:29 2010 +0200 (2010-09-20)
parents 0b7e87f2dc91
children 1cd9e69b85cb
files framework/env/ui/field/select.lua
line diff
     1.1 --- a/framework/env/ui/field/select.lua	Mon Sep 20 15:29:23 2010 +0200
     1.2 +++ b/framework/env/ui/field/select.lua	Mon Sep 20 20:11:29 2010 +0200
     1.3 @@ -1,10 +1,11 @@
     1.4  --[[--
     1.5  ui.field.select{
     1.6    ...                                 -- generic ui.field.* arguments, as described for ui.autofield{...}
     1.7 -  foreign_records = foreign_records,  -- list of records to be chosen from, or function returning such a list
     1.8 -  foreign_id      = foreign_id,       -- name of id field in foreign records
     1.9 -  foreign_name    = foreign_name,     -- name of field to be used as name in foreign records
    1.10 -  format_options  = format_options    -- format options for format.string
    1.11 +  foreign_records  = foreign_records,  -- list of records to be chosen from, or function returning such a list
    1.12 +  foreign_id       = foreign_id,       -- name of id field in foreign records
    1.13 +  foreign_name     = foreign_name,     -- name of field to be used as name in foreign records
    1.14 +  format_options   = format_options    -- format options for format.string
    1.15 +  disabled_records = disabled_list     -- table of record keys that should be disabled
    1.16  }
    1.17  
    1.18  This function inserts a select field in the active slot. For description of the generic field helper arguments, see help for ui.autofield{...}.
    1.19 @@ -53,6 +54,7 @@
    1.20                tag     = "option",
    1.21                attr    = {
    1.22                  value    = key,
    1.23 +                disabled = ((args.disabled_records and args.disabled_records[key] and "1" ) or nil),
    1.24                  selected = ((key == args.value) and "selected" or nil)
    1.25                },
    1.26                content = format.string(

Impressum / About Us