webmcp
view framework/env/ui/partial.lua @ 75:faedbc8615e0
Allow particular records to be selected and/or disabled in ui.field.select{...}, even if they share the same key, and never select more than one record
author | jbe |
---|---|
date | Wed Jun 20 00:35:02 2012 +0200 (2012-06-20) |
parents | f3d3203cd2e4 |
children |
line source
1 --[[--
2 ui.partial{
3 module = module, -- module to be used to reload inner contents
4 view = view, -- view to be used to reload inner contents
5 id = id, -- id to be used to reload inner contents
6 params = params, -- params to be used to reload inner contents
7 target = target, -- id of HTML element containing contents to be replaced
8 content = function()
9 ...
10 end
11 }
13 Calling this function declares that the inner contents can be requested
14 directly via the given module, view, id and params. The parameter "target"
15 specifies the id of the HTML element, which should be replaced when
16 reloading partially.
18 The function has an effect on inner calls of ui.link{..., partial = {...}}
19 and ui.form{..., partial = {...}}.
21 --]]--
23 function ui.partial(args)
24 local old_state = ui._partial_state
25 ui._partial_state = table.new(args)
26 ui._partial_state.param_name_hash = {}
27 if args.param_names then
28 ui.add_partial_param_names(args.param_names)
29 end
30 args.content()
31 ui._partial_state = old_state
32 end