Crosstab
by Yuriy Bablyukh
HTML
<link rel="stylesheet" type="text/css" href="http://build-master.jaspersoft.com:7680/jrs-pro-feature-amber-adv/scripts/components/table/css/perfect-scrollbar.css">
<link rel="stylesheet" type="text/css" href="http://build-master.jaspersoft.com:7680/jrs-pro-feature-amber-adv/scripts/components/table/css/table.css">
<link rel="stylesheet" type="text/css" href="http://build-master.jaspersoft.com:7680/jrs-pro-feature-amber-adv/scripts/lib/jquery/theme/redmond/jquery-ui-1.8.20.custom.css">
<script src="http://build-master.jaspersoft.com:7680/jrs-pro-feature-amber-adv/scripts/lib/require-jquery-2.1.2.js"></script>
<script src="http://build-master.jaspersoft.com:7680/jrs-pro-feature-amber-adv/scripts/require.config.js"></script>
<script>
var __jrsConfigs__ = {
urlContext : "http://build-master.jaspersoft.com:7680/jrs-pro-feature-amber-adv",
isXdm: true
};
require.config({
baseUrl: __jrsConfigs__.urlContext + "/scripts",
});
</script>
<div id="container" style="margin-top:20px;height:400px;width:701px"></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="resizeSelected">Resize selected</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",
header: {
getData: headerDataProvider,
Strategy: DynamicGridStrategy,
gridHeight: 100,
gridWidth: 201,
colsCount: 3,
rowsCount: 3,
colsBufferSize: 5
},
columnGroup: {
getData: columnGroupDataProvider,
Strategy: DynamicGridStrategy,
gridHeight: 100,
gridWidth: 500,
colsCount: 3,
rowsCount: 3,
colsBufferSize: 5
},
rowGroup: {
getData: rowGroupDataProvider,
Strategy: DynamicGridStrategy,
gridHeight: 300,
gridWidth: 201,
colsCount: 3,
rowsCount: 3,
colsBufferSize: 5
},
data: {
getData: dataProvider,
Strategy: DynamicGridStrategy,
gridHeight: 300,
gridWidth: 500,
colsCount: 3,
rowsCount: 3,
colsBufferSize: 5
}
});
crosstab.render();
$("#left").on("click", function(event) {
var scroollPos = crosstab.scrollPos();
crosstab.scrollTo(scroollPos.top, scroollPos.left - 1);
event.stopPropagation();
});
$("#right").on("click",...