How can I help you?
Es5 pane content in EJ2 JavaScript Splitter control
5 Mar 202616 minutes to read
Describes how to provide plain text, HTML markup, or other JavaScript UI controls as content of splitter.
HTML Markup
Splitter is a layout container control. Existing HTML markup can be converted into splitter panes to add pane content dynamically.
// Initialize Splitter control
var splitObject = new ej.layouts.Splitter({
height: '200px',
paneSettings: [
{ size: '200px',
content: '<div class="content"><h3 class="h3">PARIS </h3>Paris, the city of lights and love - this short guide is full of ideas for how to make the most of the romanticism...</div>'
},
{ size: '200px',
content: '<div class="content"><h3 class="h3">CAMEMBERT </h3>The village in the Orne département of Normandy where the famous French cheese is originated from.</div>'
},
{ size: '200px',
content: '<div class="content"><h3 class="h3">GRENOBLE </h3>The capital city of the French Alps and a major scientific center surrounded by many ski resorts, host of the Winter Olympics in 1968.</div>'
}
],
width: '600px'
});
// Render initialized splitter
splitObject.appendTo('#splitter');<!DOCTYPE html><html lang="en"><head>
<title>Essential JS 2 Splitter </title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Essential JS 2 Uploader Component">
<meta name="author" content="Syncfusion">
<link href="index.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/32.2.3/ej2-base/styles/bootstrap5.3.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/32.2.3/ej2-layouts/styles/bootstrap5.3.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/32.2.3/ej2-buttons/styles/bootstrap5.3.css" rel="stylesheet">
<script src="https://cdn.syncfusion.com/ej2/32.2.3/dist/ej2.min.js" type="text/javascript"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div id="container">
<!--element which is going to render the splitter-->
<div id="splitter">
<div></div>
<div></div>
<div></div>
</div>
</div>
<script>
var ele = document.getElementById('container');
if(ele) {
ele.style.visibility = "visible";
}
</script>
<script src="index.js" type="text/javascript"></script>
</body></html>Pane content can also be provided via inner HTML.
// Initialize Splitter control
var splitObject = new ej.layouts.Splitter({
height: '200px',
paneSettings: [
{ size: '200px'
},
{ size: '200px'
},
{ size: '200px'
}
],
width: '600px'
});
// Render initialized splitter
splitObject.appendTo('#splitter');<!DOCTYPE html><html lang="en"><head>
<title>Essential JS 2 Splitter </title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Essential JS 2 Uploader Component">
<meta name="author" content="Syncfusion">
<link href="index.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/32.2.3/ej2-base/styles/bootstrap5.3.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/32.2.3/ej2-layouts/styles/bootstrap5.3.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/32.2.3/ej2-buttons/styles/bootstrap5.3.css" rel="stylesheet">
<script src="https://cdn.syncfusion.com/ej2/32.2.3/dist/ej2.min.js" type="text/javascript"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div id="container">
<!--element which is going to render the splitter-->
<div id="splitter">
<div>
<div class="content">
<h3 class="h3">PARIS </h3>
Paris, the city of lights and love - this short guide is full of ideas for how to make the most of the romanticism...
</div>
</div>
<div>
<div class="content">
<h3 class="h3">CAMEMBERT </h3>
The village in the Orne département of Normandy where the famous French cheese is originated from.
</div>
</div>
<div>
<div class="content">
<h3 class="h3">GRENOBLE </h3>
The capital city of the French Alps and a major scientific center surrounded by many ski resorts, host of the Winter Olympics in 1968.
</div>
</div>
</div>
</div>
<script>
var ele = document.getElementById('container');
if(ele) {
ele.style.visibility = "visible";
}
</script>
<script src="index.js" type="text/javascript"></script>
</body></html>JavaScript UI controls
Any JavaScript UI control, including its native and control-specific events, can be rendered inside a splitter pane.
Refer to the Accordion within splitter and Listview within splitter examples.
Plain content
Plain text can be added as pane content using inner HTML or the content API.
// Initialize Splitter control
var splitObject = new ej.layouts.Splitter({
height: '200px',
paneSettings: [
{ size: '200px', content: 'Left pane'
},
{ size: '200px', content: 'Middle pane'
},
{ size: '200px', content: 'Right pane'
}
],
width: '600px'
});
// Render initialized splitter
splitObject.appendTo('#splitter');<!DOCTYPE html><html lang="en"><head>
<title>Essential JS 2 Splitter </title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Essential JS 2 Uploader Component">
<meta name="author" content="Syncfusion">
<link href="index.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/32.2.3/ej2-base/styles/bootstrap5.3.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/32.2.3/ej2-layouts/styles/bootstrap5.3.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/32.2.3/ej2-buttons/styles/bootstrap5.3.css" rel="stylesheet">
<script src="https://cdn.syncfusion.com/ej2/32.2.3/dist/ej2.min.js" type="text/javascript"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div id="container">
<!--element which is going to render the splitter-->
<div id="splitter">
<div></div>
<div></div>
<div></div>
</div>
</div>
<script>
var ele = document.getElementById('container');
if(ele) {
ele.style.visibility = "visible";
}
</script>
<script src="index.js" type="text/javascript"></script>
</body></html>Pane content using selector
An HTML element can be assigned to the pane content property using query selectors (for example, ID or CSS class).
The following code demonstrates fetching an element by ID and assigning it to a pane.
// Initialize Splitter control
var splitObject = new ej.layouts.Splitter({
height: '200px',
paneSettings: [
{ size: '25%', min: '60px', content: '#left-pane-content' },
{ size: '50%', min: '60px', content: '#middle-pane-content' },
{ size: '25%', min: '60px', content: '#last-pane-content' }
],
width: '100%',
separatorSize: 4
});
// Render initialized splitter
splitObject.appendTo('#horizontal');<!DOCTYPE html><html lang="en"><head>
<title>Essential JS 2 Splitter </title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Essential JS 2 Uploader Component">
<meta name="author" content="Syncfusion">
<link href="index.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/32.2.3/ej2-base/styles/bootstrap5.3.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/32.2.3/ej2-layouts/styles/bootstrap5.3.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/32.2.3/ej2-buttons/styles/bootstrap5.3.css" rel="stylesheet">
<script src="https://cdn.syncfusion.com/ej2/32.2.3/dist/ej2.min.js" type="text/javascript"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div id="container">
<!--element which is going to render the splitter-->
<div id="target" class="control-section">
<!-- Splitter control target -->
<div id="horizontal"></div>
</div>
<!-- pane contents -->
<div id="left-pane-content" style="display: none;">
<div>Left pane<div id="panetext">size: 25%</div>
<div id="panetext">min: 60px</div>
</div>
</div>
<div id="middle-pane-content" style="display: none;">
<span>Middle pane<div id="panetext">size: 50%</div>
<div id="panetext">min: 60px</div>
</span>
</div>
<div id="last-pane-content" style="display: none;">
<span>Right pane<div id="panetext">size: 25%</div>
<div id="panetext">min: 60px</div>
</span>
</div>
</div>
<script>
var ele = document.getElementById('container');
if(ele) {
ele.style.visibility = "visible";
}
</script>
<script src="index.js" type="text/javascript"></script>
</body></html>