webmcp
view framework/env/ui/partial.lua @ 175:20e393d2e6e1
Completed comments and minor code cleanup in JSON library; Added emergency garbage collection for memory allocation in json.export function
author | jbe |
---|---|
date | Fri Aug 01 21:54:45 2014 +0200 (2014-08-01) |
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