annotate framework/env/ui/partial.lua @ 51:791849c58105
class_prototype.object:try_save() can create rows with DEFAULT VALUES
 | author | 
 jbe | 
 | date | 
 Fri Jun 10 14:23:35 2011 +0200 (2011-06-10) | 
 | parents | 
 f3d3203cd2e4  | 
 | children | 
  | 
 
 | rev | 
   line source | 
| 
jbe/bsw@11
 | 
     1 --[[--
 | 
| 
jbe/bsw@11
 | 
     2 ui.partial{
 | 
| 
jbe@12
 | 
     3   module  = module,     -- module to be used to reload inner contents
 | 
| 
jbe@12
 | 
     4   view    = view,       -- view   to be used to reload inner contents
 | 
| 
jbe@12
 | 
     5   id      = id,         -- id     to be used to reload inner contents
 | 
| 
jbe@12
 | 
     6   params  = params,     -- params to be used to reload inner contents
 | 
| 
jbe@12
 | 
     7   target  = target,     -- id of HTML element containing contents to be replaced
 | 
| 
jbe/bsw@11
 | 
     8   content = function()
 | 
| 
jbe@12
 | 
     9     ...
 | 
| 
jbe/bsw@11
 | 
    10   end
 | 
| 
jbe/bsw@11
 | 
    11 }
 | 
| 
jbe/bsw@11
 | 
    12 
 | 
| 
jbe@12
 | 
    13 Calling this function declares that the inner contents can be requested
 | 
| 
jbe@12
 | 
    14 directly via the given module, view, id and params. The parameter "target"
 | 
| 
jbe@12
 | 
    15 specifies the id of the HTML element, which should be replaced when
 | 
| 
jbe@12
 | 
    16 reloading partially.
 | 
| 
jbe@12
 | 
    17 
 | 
| 
jbe@12
 | 
    18 The function has an effect on inner calls of ui.link{..., partial = {...}}
 | 
| 
jbe@12
 | 
    19 and ui.form{..., partial = {...}}.
 | 
| 
jbe/bsw@11
 | 
    20 
 | 
| 
jbe/bsw@11
 | 
    21 --]]--
 | 
| 
jbe/bsw@11
 | 
    22 
 | 
| 
jbe/bsw@11
 | 
    23 function ui.partial(args)
 | 
| 
jbe/bsw@11
 | 
    24   local old_state = ui._partial_state
 | 
| 
jbe/bsw@11
 | 
    25   ui._partial_state = table.new(args)
 | 
| 
jbe/bsw@11
 | 
    26   ui._partial_state.param_name_hash = {}
 | 
| 
jbe/bsw@11
 | 
    27   if args.param_names then
 | 
| 
jbe/bsw@11
 | 
    28     ui.add_partial_param_names(args.param_names)
 | 
| 
jbe/bsw@11
 | 
    29   end
 | 
| 
jbe/bsw@11
 | 
    30   args.content()
 | 
| 
jbe/bsw@11
 | 
    31   ui._partial_state = old_state
 | 
| 
jbe/bsw@11
 | 
    32 end
 |