Crosstab
HTML
<link rel="stylesheet" type="text/css" href="http://localhost:8080/JRS-pro/scripts/components/table/css/perfect-scrollbar.css">
<link rel="stylesheet" type="text/css" href="http://localhost:8080/JRS-pro/scripts/components/table/css/table.css">
<link rel="stylesheet" type="text/css" href="http://localhost:8080/JRS-pro/scripts/lib/jquery/theme/redmond/jquery-ui-1.8.20.custom.css">
<script src="http://localhost:8080/JRS-pro/scripts/lib/require-jquery-2.1.2.js"></script>
<script src="http://localhost:8080/JRS-pro/scripts/require.config.js"></script>
<script>
var __jrsConfigs__ = {
urlContext : "http://localhost:8080/JRS-pro",
isXdm: true
};
require.config({
baseUrl: __jrsConfigs__.urlContext + "/scripts",
});
</script>
<div id="container" style="margin-top:20px;height:300px;width:300px"></div>
<button id="left" style="margin-top: 50px;">Left</button>
<button id="right">Right</button>
<button id="top" style="margin-top: 50px;">Top</button>
<button id="bottom">Bottom</button>
<button id="changeData">Change data</button>
JavaScript
require([
"jquery",
"components/table/Crosstab",
"components/table/base/DynamicGridStrategy",
"components/table/base/StaticGridDataProvider",
], function($, Crosstab, DynamicGridStrategy, StaticGridDataProvider) {
//Create data provider
var dataProvider = new StaticGridDataProvider(gridData).getData,
headerDataProvider = new StaticGridDataProvider(headerData).getData,
columnGroupDataProvider = new StaticGridDataProvider(columnGroupData).getData,
rowGroupDataProvider = new StaticGridDataProvider(rowGroupData).getData;
//create and init table component
var crosstab = new Crosstab({
el: "#container",
width: 300,
height: 300,
header: {
getData: headerDataProvider,
//Strategy: DynamicGridStrategy,
gridHeight: 100,
gridWidth: 100,
//colsCount: 2,
//rowsCount: 4,
colsBufferSize: 100,
rowsBufferSize: 100
},
columnGroup: {
getData: columnGroupDataProvider,
//Strategy: DynamicGridStrategy,
gridHeight: 100,
gridWidth: 200,
//colsCount: 4,
//rowsCount: 4,
rowsBufferSize: 4,
colsBufferSize: 4
},
rowGroup: {
getData: rowGroupDataProvider,
//Strategy: DynamicGridStrategy,
gridHeight: 200,
gridWidth: 100,
//colsCount: 2,
//rowsCount: 4,
rowsBufferSize: 4,
colsBufferSize: 2
},
data: {
getData: dataProvider,
//Strategy: DynamicGridStrategy,
gridHeight: 200,
gridWidth: 200,
colsCount: 4,
rowsCount: 4,
colsBufferSize: 4,
rowsBufferSize: 4
}
});
console.log(crosstab.header());
crosstab.render();
...