JRS 201 - User can resize viewport API
HTML
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/smoothness/jquery-ui.css">
<link rel="stylesheet" href="http://build-master.jaspersoft.com:7680/jrs-pro-feature-amber-adv/scripts/components/table/css/table.css">
<link type="text/css" rel="stylesheet" href="http://build-master.jaspersoft.com:7680/jrs-pro-feature-amber-adv/scripts/components/table/css/perfect-scrollbar.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:500px;width:100%"></div>
CSS
/*! perfect-scrollbar - v0.4.6
* http://noraesae.github.com/perfect-scrollbar/
* Copyright (c) 2013 HyeonJe Jun; Licensed MIT */
.ps-container .ps-scrollbar-x-rail{position:absolute;bottom:3px;height:8px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;opacity:0.7;filter:alpha(opacity=70);-o-transition:background-color .2s linear,opacity .2s linear;-webkit-transition:background-color.2s linear,opacity .2s linear;-moz-transition:background-color .2s linear,opacity .2s linear;transition:background-color .2s linear,opacity .2s linear}.ps-container:hover .ps-scrollbar-x-rail,.ps-container.hover .ps-scrollbar-x-rail{opacity:.6;filter:alpha(opacity=60)}.ps-container .ps-scrollbar-x-rail:hover,.ps-container .ps-scrollbar-x-rail.hover{/*background-color:#eee;*/opacity:.9;filter:alpha(opacity=90)}.ps-container .ps-scrollbar-x-rail.in-scrolling{opacity:.9;filter:alpha(opacity=90)}.ps-container .ps-scrollbar-y-rail{position:absolute;right:3px;width:8px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;opacity:0.7;filter:alpha(opacity=70);-o-transition:background-color .2s linear,opacity .2s linear;-webkit-transition:background-color.2s linear,opacity .2s linear;-moz-transition:background-color .2s linear,opacity .2s linear;transition:background-color .2s linear,opacity .2s linear}.ps-container:hover .ps-scrollbar-y-rail,.ps-container.hover .ps-scrollbar-y-rail{opacity:.6;filter:alpha(opacity=60)}.ps-container .ps-scrollbar-y-rail:hover,.ps-container .ps-scrollbar-y-rail.hover{/*background-color:#eee;*/opacity:.9;filter:alpha(opacity=90)}.ps-container .ps-scrollbar-y-rail.in-scrolling{opacity:.9;filter:alpha(opacity=90)}.ps-container .ps-scrollbar-x{position:absolute;bottom:0;height:8px;background-color:#aaa;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-o-transition:background-color .2s linear;-webkit-transition:background-color.2s linear;-moz-transition:background-color .2s linear;transition:background-color .2s...
JavaScript
require([
"jquery",
"components/table/base/BaseGrid",
"components/table/FixedHeaderGrid",
"components/table/base/DynamicGridStrategy",
"components/table/base/StaticGridDataProvider",
], function($, BaseGrid, FixedHeaderGrid, DynamicGridStrategy, StaticGridDataProvider) {
//Create data provider
var dataProvider = new StaticGridDataProvider(gridData).getData,
headerDataProvider = new StaticGridDataProvider(headerGridData).getData;
//create and init table component
var baseGrid = new FixedHeaderGrid({
el: "#container",
header: {
getData: headerDataProvider,
rowsHeight: 50
},
data: {
getData: dataProvider,
colsCount: 5,
rowsCount: 5,
}
});
//Initiate table rendering
baseGrid.render();
var resizer = _.bind(baseGrid.resizeGrid, baseGrid),
headerResizer = _.bind(function(event, ui) {
this.resizeHeader(ui.size.height);
}, baseGrid);
jQuery(window).on("resize", resizer);
jQuery("#container").resizable({
resize: resizer
//stop: resizer
});
jQuery(".jrs-header-grid-container").resizable({
handles: "s",
resize: headerResizer,
//stop: headerResizer
});
});
//DATA
var headerGridData = [[{label: "Header.", colspan: 10},null,null,null,null, null,null,null,null,null,{label: "34"},{label: "35"},{label: "21"},{label: "asdf"},{label: "23"}]];
//Grid data
var gridData = [
[{label: "21", rowspan: 10},{label: "22"},{label: "23"},{label:...