annotate framework/env/ui/partial.lua @ 200:035b58aa430a
Improve performance of pairs and ipairs in JSON library
author |
jbe |
date |
Thu Aug 14 01:11:24 2014 +0200 (2014-08-14) |
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
|