import React from 'react'; import ReactDOM from 'react-dom'; import JqxGrid from '../../../jqwidgets-react/react_jqxgrid.js'; import JqxButton from '../../../jqwidgets-react/react_jqxbuttons.js'; class App extends React.Component { componentDidMount() { this.refs.ExpandButton.on('click', () => { let groupnum = parseInt($("#groupnum").val()); if (!isNaN(groupnum)) { this.refs.Grid.expandgroup(groupnum); } }); // collapse group. this.refs.CollapseButton.on('click', () => { let groupnum = parseInt($("#groupnum").val()); if (!isNaN(groupnum)) { this.refs.Grid.collapsegroup(groupnum); } }); // expand all groups. this.refs.ExpandAllButton.on('click', () => { this.refs.Grid.expandallgroups(); }); // collapse all groups. this.refs.CollapseAllButton.on('click', () => { this.refs.Grid.collapseallgroups(); }); // trigger expand and collapse events. this.refs.Grid.on('groupexpand', (event) => { let args = event.args; document.getElementById('expandedgroup').innerHTML = "Group: " + args.group + ", Level: " + args.level; }); this.refs.Grid.on('groupcollapse', (event) => { let args = event.args; document.getElementById('collapsedgroup').innerHTML = "Group: " + args.group + ", Level: " + args.level }); } render() { let source = { datatype: "xml", datafields: [ { name: 'CompanyName', map: 'm\\:properties>d\\:CompanyName', type: 'string' }, { name: 'ContactName', map: 'm\\:properties>d\\:ContactName', type: 'string' }, { name: 'ContactTitle', map: 'm\\:properties>d\\:ContactTitle', type: 'string' }, { name: 'City', map: 'm\\:properties>d\\:City', type: 'string' }, { name: 'PostalCode', map: 'm\\:properties>d\\:PostalCode', type: 'string' }, { name: 'Country', map: 'm\\:properties>d\\:Country', type: 'string' } ], root: "entry", record: "content", id: 'm\\:properties>d\\:CustomerID', url: "../sampledata/customers.xml" }; let dataAdapter = new $.jqx.dataAdapter(source); let columns = [ { text: 'Company Name', datafield: 'CompanyName', width: 250 }, { text: 'City', datafield: 'City', width: 120 }, { text: 'Country', datafield: 'Country' } ]; return (


Group:


Event Log:
Expanded Group:
Collapsed Group:
) } } ReactDOM.render(, document.getElementById('app'));