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 changes only the parameters you passed. It destroys the current component and initializes a new one.

Example

// create Booking
const booking = 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
booking.setConfig({
config: {
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: