Masterdata

Connect a master data element to your table and get automatically a master data form!


Configure the list columns and the form with JSON to get it functionally and good looking!


The data access rights are easily configured in the backend and displayed in the master data form.



User manual

Masterdata

Listing record functions:

  • List
  • Sort
  • Filter

Crud functions:

  • Create, New record
  • Read, Load record
  • Update, Save record
  • Delete record

Export functions:

  • CSV export
  • Excel export
  • PEF export

Configuration functions:

  • Column order
  • Column width
  • Column selection
  • Data read limit

The form is devided into two parts. In the top is the record list with filter and sorting. In the bottom the record is displayed and can be edited in the form. You can drag the line between to enlarge or shrink the listing.

Listing Functions

Sort

Actually you can sort the displayed records. A callback for the server will be installed later.

Header filter

this are the filters:

  • like (default)
  • =
  • >= or >
  • <= or <
  • !=
Column Order

With drap & drop in the column header you can move the colum to the desired position.

Column Width

Set the cursor between the columns. The Cursor changes to: <->By drag & drop you can adjust the column width.

List

Each record ist displayed in 1 line. The columns are defined in the datadefintion of tabulator. The following symbols display the rights of the user:

  • Edit edit
  • Löschen delete
  • blocked blocked

Functions for the form

New

New empties the form. In future default values for the fields will be supported.

Edit (by Click in the List)

By clicking on the line the recordset is displayed in the form and can be edited. Independent from the displayed columns in tabulator the whole record already loaded in the row. A new load from the server is not necessary.

Cancel

Cancel undos the changes and displays the original record.

Save

Before saving the data a validation by jsonform is done. If its failed you first have to correct the values. In future the data-access-class will do a validation check for the fieldtype and the user rights. Other checks have to be progammed by yourself.

Delete (X click in the List)

The user rights are implemented. If the ban is displayed, deletion is not allowed. After a confirmation question, the record will be deleted. The form displays an empty record.

Dropdown Menu

Options:

  • utf-8 CSV Export
  • Excel Export
  • PDF Export
  • Set read limit
  • Choose columns
  • Save configuration
  • Reset configuration
  • Multi select, set on
Utf-8 CSV Export, Excel Export, PDF Export

You can download the displayed data in the desired format. If not all lines are displayed, please change the record read limit.

Set read limit

You can change the record read limit to an arbitrary value. The read limit is valid until you load a new page.

Choose columns

The Choose colmns dialog allows you to choose the displayed columns.

Save configuration

(only available when loogged in)

With "Save configuration" you save the choosen columns, the order of the columns and the the column width.

Reset configuration

(only available when loogged in)

By reseting the configuration the default columns, its order and with is set to default.

Multi select on

For some special functions the selection of 1 line can be changed to multi line selection.


Developer

Table requirement: primary key of the table

A table for master data has to fullfill the following rules:

  • the Primary key has to consist of a single field
    • INT, autoincrement
  • creatorID (by using the data access rights )
    • INT

The primary key is a hidden field in the master data form. It can not be changed!

Masterdata form on the fly

Checkout the generation of a masterdata form on the fly:

Attention, generate a table is only allowed on this demonstration page. This functionality is normally turned off!

Open datadefinition as page

you can open the datadefintion as:

Create a datadefinition out of your table

The datadefinition contains details for reading, saving and displaying a recordset.

The following steps are necessary to create your own datadefinition:

  • er_customer, if not exist create it with "k8examples.sql"
  • generate your datadefinition
  • folder <myproject> create a folder: mycustomer
  • save the datadefinition in your folder mycustomer with the name "mycustomer" as json file.
  • look in your browser:
    index.php?datadefID=mycustomer&page=masterdata

kitsamples/customerbasic/customerbasic.json:

Place a masterdata plugin element on your page

The masterdata plugin offers this elements:

  • master data form
  • list with optional edit functions
  • form only

To add an edit function to the list, please look for the "edittype" beneath.

Master data

List (tabulator)

Form only

The return values of "masterdata" are:

Datadefinition

Properties and sections:

  • name: the displayed name
  • key: necessary for edit
  • rightcheck: look to the explanation
  • masterdata: the main parameters
  • tabulator: please have a look to: tabulator.info
  • k8form: please have a look to: k8form
  • html: the html snippets
  • data: for form only

To change the look of your masterdata form, please configure tabulator (list at the top) and k8form (form at the bottom)

JSON structure:

key

The key column is used for edit functions. If the key value is zero, it's a new record.

rightcheck

The backend adds automatically:

settings.masterdata:

  • right_usercreate: "0" or "1"

recordset

  • right_userupdate: "0" or "1"
  • right_userdelete: "0" or "1"

masterdata

menulefthtml

Adds drop down elements to the dropdown menu:

Add a class to the <a> element (js_pdf_example). So you can react on it in the call back function.

edittype

  • 0 no controls
  • 1 insert with reload (only catalog plugin)
  • 2 innerHTML (form_selector)
  • 3 overlay
  • 4 new tab
  • 5 new window
  • 6 own line in catalog template (only catalog plugin)
  • 7 own line with special template (only catalog plugin)
  • 8 master data form
  • 9 link in this window

Call back functions

Extend the datadefintitions with call back functions:

the parameters:

  • settings: configuration of the element
  • el_md: the masterdata html element
  • dat: the record with column value pairs
  • e: the event
  • el: the source element
  • selected: the selected rows
  • row_actual: the current row

add tinymce

additional declarations in the datadefinition:

In the head of the page you have to add the tinimce library.

After the declaration of the JavaScript variables at head_end the call back functions are added to the datadefinition: settings. The JavaScript file for this is masterdata/templates/tinymce.js.

In "k8form" the textareas with the class tinymce will get the tinymce editor.

The image list for tinymce is initialized by the init of tinymce. By each record the image_list changes, so tinymce is removed and initialized again.

add image support

additional declarations in the datadefinition:

Frontend

the following elements are added into the masterdata plugin:

  • Upload area for the image
  • Image list with with sorter and control elements

If tinymce is enabled the image list is also displayed and updated in tinymce.

Backend

by reading the main recordset, the following columns are added:

  • image_ID
  • image_file
  • image_orientation
  • image_aspectratio
  • image_width
  • image_height
  • image_count
  • image_array
    • array with images, same the columns above

html

The html snippets define the looking of the master data form. To overwrite the default, you can define your own snippets.

settings.html.masterdata.<property>

  • layout
  • wrapper
  • headline
  • filterformwrapper
  • tabulatorwrapper
  • formwrapper
  • main
  • footline

Create a folder for the datadefnition, name: <datadefID>. Write the HTML-Files with this names:

<datadefID>_<masterdata>_<property>.html

Please regard in your snippets the classes:

  • "masterdata"
  • "tabulator"
  • "js"
  • "js_dirty" for the edit symbol
  • "js_middle" for the message by messages mode<>4
  • Save button needs to be: type="submit"
  • Cancel button: class="js_cancel"

if you place tabulator and form side by side:

An example for a side by side form is in "kitsamples/customerleft".

data

data is only supported in form mode (notabulator:true):

Linking with datalist

Requirements for the input data definition:

  • settingsadditionals
  • k8form

Example for the user:

Requirements for the source datadefintion:

In the source table the column <name> should be a "unique" column. This column is requested in the form.