fields

defines data fields

array fields;

Example

webix.ui({
    view: "pivot",
    predicates: {
        date: webix.Date.dateToStr(webix.i18n.dateFormat),
    },
    fields: [
        { id: "client", value: "client", type: "text" },
        { id: "date", value: "date", type: "date", predicate: "date" },
        { id: "statistics", value: "statistics", type: "number" },
    ],
});

Related samples

Details

The property allows specifying data fields manually. Each object can include the following fields:

  • id (string) - required, the field ID. Must coincide with the data item field name
  • type (string) - required, the field type. Possible values are:
    • "text" - if the field value is a string
    • "number" - if the field value is a number
    • "date" - if the field value is a date
  • value (string) - required, the field value that will be displayed
  • predicate (string) - the predicate of the field
  • prepare (function) - prepares raw data. Accepts a single parameter - raw value (e.g. "2007").

The prepare function accepts a raw value (e.g. "2007") and makes it digestible for further processing by the predicate setting. Thus the "2007" can be transformed into JS date (Mon Jan Jan 01 2007 00:00:00).

The predicate field in its turn will format the transformed value according to the predicates set in the predicates object in the configuration.

Note that if the fields property is not set, fields will be automatically generated based on the incoming data.

See also
Back to top