React UI Components Documentation
ReactJS Panel Component
The Panel component for ReactJS represents a widget, which is a container for other widgets or elements.
It automatically adds horizontal and vertical scrollbars, if the content is not fully visible.
Prerequisites
Refer to ReactJS Getting Started before you start with this help topic.
Configuration
The Panel component for ReactJS requires the following imports.
import React from 'react';import ReactDOM from 'react-dom'; import JqxPanel from 'jqwidgets-react/react_jqxpanel.js';
Then we create our component class. Properties and methods are put as ReactJS props.
class App extends React.Component { render () { return ( <JqxPanel width={220} height={220}> <div> <h3>Early History of the Internet</h3> </div> <div> <ul> <li>1961 First packet-switching papers</li> <li>1966 Merit Network founded</li> <li>1966 ARPANET planning starts</li> <li>1969 ARPANET carries its first packets</li> <li>1970 Mark I network at NPL (UK)</li> <li>1970 Network Information Center (NIC)</li> <li>1971 Merit Network's packet-switched network operational</li> <li>1971 Tymnet packet-switched network</li> <li>1972 Internet Assigned Numbers Authority (IANA) established</li> <li>1973 CYCLADES network demonstrated</li> <li>1974 Telenet packet-switched network</li> <li>1976 X.25 protocol approved</li> <li>1979 Internet Activities Board (IAB)</li> <li>1980 USENET news using UUCP</li> <li>1980 Ethernet standard introduced</li> <li>1981 BITNET established</li> </ul> </div> </JqxPanel> ) }}
Finally we render our class in the desired HTML element:
ReactDOM.render(<App />, document.getElementById('app'));
Methods & Properties
In order to change any property or call any method, we need a reference to the component.
For that we use the ReactJS "ref" Callback Attribute:
<JqxPanel ref='myPanel' width={220} height={220}..... />
Now, when we have a reference, we need to call the desired property/method.
This is done in the componentDidMount() ReactJS Component Lifecycle method.
class App extends React.Component { componentDidMount() { //your logic } render () { return ( .... ) }};
This is how you call methods & props:
//Get Methodslet date = this.refs.myPanel.val(); //Set Methodsthis.refs.myPanel.val("2013/3/3"); //Get Propertieslet height = this.refs.myPanel.height(); //Set Propertiesthis.refs.myPanel.height(200);
Every component have a method setOptions which accepts a object as an argument. This object contains component settings.
this.refs.myPanel.setOptions({ showOtherMonthDays: 'false', showWeekNumbers: 'true'})
Every component also have a method getOptions which returns a object containing the component settings.
Panel Examples
Overview
The following example demonstrates how to create a Panel component.
Disabled Panel
The following example demonstrates how to disable the Panel component.