Skip to main content

Renderer methods

new seatsio.SeatingChart({...}).render(); returns a seating chart object with some methods you can access for use in your application.

var chart = new seatsio.SeatingChart({...}).render();
console.log(chart);

You can invoke these methods in two ways:

  • directly on the seatsio.SeatingChart object you created. This is recommended if you want to invoke one of these methods to react to a user action.
var chart = new seatsio.SeatingChart({...}).render();
$('#myButton').on('click', () => {
chart.selectBestAvailable({'number': 2});
});
  • or on the object that's passed to the onChartRendered callback, which you can provide in your chart config. This is the way to go when you want to invoke one of these methods right after the floor plan was fully loaded, and without any user action.
new seatsio.SeatingChart({
...,
onChartRendered: chart => {
chart.selectBestAvailable({'number': 2});
},
...
}).render();
Tip

These methods will only work after a chart is fully rendered. That means this won't work:

var chart = new seatsio.SeatingChart({...}).render();
chart.selectBestAvailable({'number': 2}); // WON'T WORK

That's because the render() method may still be doing a number of async operations in the background.