deform的jquery选项树小部件
deform_widget_jquery_option_tree的Python项目详细描述
这个包裹使 jQuery Option Tree 可用作deform form library 小装置。jquery选项树将json选项树动态转换为 创建了允许您从中选择一个嵌套选项的<;选择>;元素 树。
目前只实现了一个非常特定的用例的特性, 从这样的数据结构进行分层浏览:
key value --- ----- 1 Option 1 11 Suboption 1.1 111 Subsubption 1.1.1 112 Subsubption 1.1.2 12 Suboption 1.2 2 Option 2 21 Suboption 2.1 22 Suboption 2.2 3 Option 3
这适用于从诸如 ISCO08或 NACE Rev. 2
该实现当前要求rest服务公开数据 有两个端点可通过公共基url(即^{tt1})访问$ 小部件选项):
- json_url has to return the top level key/value pairs
- json_url with the GET parameter ^{tt2}$ has to return the child elements for the given id.
- json_url + ‘/<id>/lineage’ has to return the lineage of IDs from root to leaf for the given <id>.
示例:
json_url = '/api/classifications/nace_rev2' # GET call to '/api/classifications/nace_rev2' # has to return a structure like this: { A: "LAND- UND FORSTWIRTSCHAFT, FISCHEREI", B: "BERGBAU UND GEWINNUNG VON STEINEN UND ERDEN", C: "VERARBEITENDES GEWERBE/HERSTELLUNG VON WAREN" } # GET call to '/api/classifications/nace_rev2?id=A' # has to return a structure like this: { A01: "Landwirtschaft, Jagd und damit verbundene Tätigkeiten", A02: "Forstwirtschaft und Holzeinschlag", A03: "Fischerei und Aquakultur" } # GET call to '/api/classifications/nace_rev2/Q8690/lineage' # has to return a structure like this: ["Q", "Q86", "Q869", "Q8690"]
有关详细信息,请参见附带的演示应用程序。
贡献
欢迎捐款,特别是如果你想增加对 插件的更通用的数据结构和/或可配置选项。
变化
0.2.1
- 修复初始化空字段时的js错误。
0.2
- 更改javascript以允许更好的配置
- 将fanstaticneed()调用移动到serialize方法。
0.1
- 初次发布。