export class Default extends SampleBase {
componentDidMount(){
var wrapper1 = document.getElementById("scroll_wrapper1");
var wrapper2 = document.getElementById("scroll_wrapper2");
wrapper1.onscroll = function() {
wrapper2.scrollLeft = wrapper1.scrollLeft;
};
wrapper2.onscroll = function() {
wrapper1.scrollLeft = wrapper2.scrollLeft;
};
}
render() {
return (<div>
<div id="scroll_wrapper1">
<div id="scroll_div"></div>
</div><div id="scroll_wrapper2">
<div id="grid_parent">
<GridComponent id="Grid" dataSource={orderDetails} height='100%' width='100%'>
<ColumnsDirective>
<ColumnDirective field='OrderID' headerText='Order ID' width='120' textAlign='Right'></ColumnDirective>
<ColumnDirective field='CustomerName' headerText='Customer Name' width='150'></ColumnDirective>
<ColumnDirective field='OrderDate' headerText='Order Date' width='130' format='yMd' textAlign='Right'/>
<ColumnDirective field='Freight' headerText='Freight' width='120' format='C2' textAlign='Right'/>
<ColumnDirective field='ShippedDate' headerText='Shipped Date' width='130' format='yMd' textAlign='Right'></ColumnDirective>
<ColumnDirective field='ShipCountry' headerText='Ship Country' width='150'></ColumnDirective>
</ColumnsDirective>
</GridComponent>
</div>
</div></div>);
}
}
|
<style>
#scroll_wrapper1,
#scroll_wrapper2 {
width: 600px;
overflow-x: scroll;
overflow-y: hidden;
}
#scroll_wrapper1 {
height: 20px;
position: -webkit-sticky !important; /* sticky the element */
position: sticky !important;
top: 80% !important;
z-index: 1 !important;
}
#scroll_wrapper2 {
height: 500px;
}
#scroll_div {
width: 900px;
height: 20px;
}
#grid_parent {
width: 900px;
height: 500px;
overflow: auto;
}
</style>
|
<GridComponent
---------
height="400px"
>
|
Index.js
return (
<div style={{ height: "100%", border: "1px solid" }}>
<style>{icons}</style>
<div style={{ height: "90%", border: "1px solid" }}>
<GridComponent
height="100%" // adapts its parent container height
>
<ColumnsDirective>{columnDirectives}</ColumnsDirective>
<Inject services={services} />
</GridComponent>
</div>
<div className="footer" style={{ height: "10%", border: "1px solid" }}>
-------
</div>
</div>
);
|
Index.html
<style>
html,
body {
height: 100%;
}
#sample {
height: 100%;
}
</style>
|