Master + tabulator child
A tabulator element with skills is added to the address master data form. The data structure consist out of 3 tables:
- exaddresses: the address table
- exaddressesskills: the assignment between addresses and skills
- exskills: the table with skills
The datadefinition with childs
excerpt of exaddresses.json:
the data has an array skills[]:
- addressID
- skillID
This array is declared as child in the childs array:
- objectclass: data_accessclas, the default class for myslq
- table: the table of your child element
- key: the primary key of the table
- fieldname: "skills", the name of your child array
- rightcheck: 0, the rights of the master element are valid
- childmode (tabulator): 1=manual, 2=appends tabulator in cbCreateStructure
- masterkey: addressID, the column of you child table, which is joined to the master
- readonly: false (default), the elements can be changed in the front end and will written back by save
- masterdata: {} properties like the sql statement or columns array can be defined
Load skills
exaddresses_head_include.php:
The variable data_skills is initialized with an array of skills.
HTML elements skills in form
datadefinition with k8form:
The HTML element #skills is placed in the form as placeholder for the tabulator table.
JavaScript Events to handle skills
exerpt of exaddresses_head_end.js
This are the events:
- cbCreateStructure
- create the tabulator table: tableTab
- cbAfterNew
- adopt rights
- tableTab.setData(empty record)
- cbAfterLoad
- adopt rights
- tableTab.setData(dat.skills)
- cbBeforeSave
- dat.skills=tableTab.getData()