React UI Components Documentation

ReactJS DockingLayout Component

The DockingLayout component for ReactJS which allows the creation of complex layouts with panels that can be floated, docked, nested, resized, pinned, unpinned and closed.

Prerequisites

Refer to ReactJS Getting Started before you start with this help topic.

Configuration

The DockingLayout component for ReactJS requires the following imports.

 
import React from 'react';
import ReactDOM from 'react-dom';
import JqxDockingLayout from 'jqwidgets-react/react_jqxdockinglayout.js';

Then we create our component class. Properties and methods are put as ReactJS props.

  
class App extends React.Component {
render () {
return (
<JqxDockingLayout
width={500} height={600}
layout={layout} resizable={false}>
<div data-container="Document1Panel">
Document 1 content
</div>
<div data-container="Document2Panel">
Document 2 content
</div>
<div data-container="ErrorListPanel">
List of errors
</div>
</JqxDockingLayout>
)
}
}

Finally we render our class in the desired HTML element:

 
ReactDOM.render(<App />, document.getElementById('app'));

Events Methods & Properties

In order to bind to any event, change any property or call any method, we need a reference to the component.
For that we use the ReactJS "ref" Callback Attribute:

 
<JqxDockingLayout ref='myDockingLayout' width={500} height={600}..... />

Now, when we have a reference, we need to call the desired event/property/method.
This is done in the componentDidMount() ReactJS Component Lifecycle method.

 
class App extends React.Component {
componentDidMount()
{
//your logic
}
render ()
{
return
(
....
)
}
};

Events

The pin event is triggered when a group has been pinned.

The following example demonstrates how to add an event listener:

 
componentDidMount ()
{
this.refs.myDockingLayout.on('pin', (event) =>
{
//your logic
});
}

Methods & Properties

This is how you call methods & props:

 
//Get Methods
let layout = this.refs.myDockingLayout.saveLayout();
//Set Methods
this.refs.myDockingLayout.loadLayout(layout);
//Get Properties
let height = this.refs.myDockingLayout.height();
//Set Properties
this.refs.myDockingLayout.height(450);

Every component have a method setOptions which accepts a object as an argument. This object contains component settings.

 
this.refs.myDockingLayout.setOptions({
minGroupWidth: 150, width: 500, height: 800
})

Every component also have a method getOptions which returns a object containing the component settings.

 
let options = this.refs.myDockingLayout.getOptions();

DockingLayout Examples

Overview

The following example demonstrates how to create a DockingLayout component.

 
import React from 'react';
import ReactDOM from 'react-dom';
import JqxDockingLayout from 'jqwidgets-react/react_jqxdockinglayout.js';
class App extends React.Component {
render () {
let layout =
[{
type: 'layoutGroup',
orientation: 'horizontal',
items: [
{
type: 'layoutGroup',
orientation: 'vertical',
width: 500,
items: [{
type: 'documentGroup',
height: 400,
minHeight: 200,
items: [{
type: 'documentPanel',
title: 'Document 1',
contentContainer: 'Document1Panel'
},
{
type: 'documentPanel',
title: 'Document 2',
contentContainer: 'Document2Panel'
}]
},
{
type: 'tabbedGroup',
height: 200,
pinnedHeight: 30,
items: [{
type: 'layoutPanel',
title: 'Error List',
contentContainer: 'ErrorListPanel'
}]
}]
}]
}];
return (
<JqxDockingLayout
width={500} height={600}
layout={layout} resizable={false}>
<div data-container="Document1Panel">
Document 1 content
</div>
<div data-container="Document2Panel">
Document 2 content
</div>
<div data-container="ErrorListPanel">
List of errors
</div>
</JqxDockingLayout>
)
}
}
ReactDOM.render(<App />, document.getElementById('app'));

DockingLayout API

API Reference of the jQWidgets DockingLayout component for React: DockingLayout API