solid-widget¶
Take a name
as an attribute and a HTML template, and create an HTML
custom element you can use as a widget. i.e.
<!-- Your custom widget to display a customer... -->
<solid-widget name="my-custom-widget">
<template>
<h2>Customer name: ${value.name}</h2>
</template>
</solid-widget>
<!-- ... used in a solid-display -->
<solid-display
data-src="http://server/projects/"
fields="name, customer"
widget-customer="my-custom-widget"
></solid-display>
In a solid-widget
, you have access to these values:
id
: id of the displayed resourcevalue
: all the values of the current resourcesname
: name of the current fieldlabel
: if defined, label of the current fieldrange
: if defined, range of the current field
NB: Do not forget to define your custom template in a
<template>
tag. Otherwise, your widget will not be declared properly.