diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2011-12-19 18:55:59 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2011-12-19 18:55:59 +0000 |
commit | 21a0fcc4c19981501e5ab87362d80f7dcb7ceeb8 (patch) | |
tree | d6c27902843a30091879b0330d9c49ddc58a5533 /libs/web/luasrc/view | |
parent | 375a476d27afae5c978b48a555fe32c94e2cf854 (diff) |
libs/web: rework DynamicList widget to support dynamic lists composed of comboboxes
Diffstat (limited to 'libs/web/luasrc/view')
-rw-r--r-- | libs/web/luasrc/view/cbi/dynlist.htm | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/libs/web/luasrc/view/cbi/dynlist.htm b/libs/web/luasrc/view/cbi/dynlist.htm index a9e77c7cce..fd626a4ecf 100644 --- a/libs/web/luasrc/view/cbi/dynlist.htm +++ b/libs/web/luasrc/view/cbi/dynlist.htm @@ -13,21 +13,14 @@ <% end end %> </div> <script type="text/javascript"> -cbi_dynlist_init('<%=cbid%>', '<%=resource%>'); -<% if self.datatype then -%> - <% if #self.keylist > 0 then -%> - cbi_combobox_init('<%=cbid .. "." .. i%>', { +cbi_dynlist_init( + '<%=cbid%>', '<%=resource%>', '<%=self.datatype%>', + <%=tostring(self.optional or self.rmempty)%> + <%- if #self.keylist > 0 then -%>, [{ <%- for i, k in ipairs(self.keylist) do -%> <%-=string.format("%q", k) .. ":" .. string.format("%q", self.vallist[i])-%> <%-if i<#self.keylist then-%>,<%-end-%> <%- end -%> - }, '<%- if not self.rmempty and not self.optional then -%> - <%-: -- Please choose -- -%> - <%- end -%>', '<%: -- custom -- %>'); - <% end -%> - <% for i=1, #vals + 1 do -%> - cbi_validate_field('<%=cbid%>.<%=i%>', <%=tostring((self.optional or self.rmempty) == true or i > #vals)%>, '<%=self.datatype%>'); - <%- end %> -<% end -%> + }, '<%: -- custom -- %>']<% end -%>); </script> <%+cbi/valuefooter%> |