Skip to main content

setConfig()

Description​

Updates the current configuration of the Booking widget

The method is used to update the current configuration of the Booking widget. It's useful when there's a need to update the underlying data set of the widget.

Usage​

setConfig(config: object): void;

Parameters​

  • config - (required) an object of the Booking configuration. See the full list of properties here
info

The method performs a shallow merge at the top level: each property you pass replaces the existing one entirely — nested objects such as cardShape or filterShape are not deep-merged. To keep previously set values inside a nested object, pass the whole object again. The method then destroys the current component and initializes a new one.

Example​

// create Booking
const widget = new booking.Booking("#root", {
data,
cardShape: {
review: false,
subtitle: false,
details: false
},
filterShape: {
date: false,
autoApply: true,
time: [
{ from: 8, to: 11, label: "Morning" },
{ from: 12, to: 16, label: "Afternoon" },
{ from: 17, to: 20, label: "Evening" }
]
}
});

//update configuration parameters
widget.setConfig({
cardShape: {
review: true
},
filterShape: {
date: true,
autoApply: false,
time: [
{ from: 9, to: 11, label: "Morning" },
{ from: 13, to: 17, label: "Afternoon" },
{ from: 18, to: 20, label: "Evening" }
]
}
});

The snippet below demonstrates how to load already filtered data: