@(Html.EJ().Spreadsheet<object>("Spreadsheet")
..//
.ClientSideEvents(events => events.LoadComplete("loadComplete"))
)
|
function loadComplete(args) {
var xlObj = this, xlElement = xlObj.element, ribbonGrp;
ribbonGrp = {
alignType: ej.Ribbon.AlignType.Rows, text: "Screen", content: [{
groups: [{
id: "minmax", toggleButtonSettings: {
contentType: ej.ContentType.TextOnly,
defaultText: "Maximize",
activeText: "Minimize",
width: 120,
height: 50,
click: "onChange"
}
}], defaults: { type: ej.Ribbon.Type.ToggleButton }
}]
};
xlObj.XLRibbon.addTabGroup(6, ribbonGrp, 5);
elemOffset = xlElement.position();
elemPos = xlElement.css("position");
}
function onChange(args) {
var xlObj = $('#Spreadsheet').data('ejSpreadsheet'), xlElement = xlObj.element, width = xlObj.model.scrollSettings.width, height = xlObj.model.scrollSettings.height;
if (args.isChecked)
xlElement.css({ "top": 0, "left": 0, "position": "fixed", "width": "100%", "height": "100%", "z-index": maxZindex() });
else
xlElement.css({ "top": elemOffset.top, "left": elemOffset.left, "position": elemPos, "width": width, "height": height, "z-index": "" });
xlObj.refreshSpreadsheet();
}
function maxZindex() {
return Math.max.apply(null,
$.map($('body *:not(.e-rowcell, .e-rowheader, .e-headercell)'), function (e, n) {
return parseInt($(e).css('z-index')) + 1 || 1;
}));
} |
<script type="text/javascript">
var isTabAdded = false;
function loadComplete(args) {
var xlObj = this, xlElement = xlObj.element;
xlObj.setWidthToColumns([111, 128, 145, 192, 159, 218]);
xlObj.XLFormat.format({ "style": { "font-weight": "bold", "vertical-align": "middle", "text-align": "center" } }, "A1:F1");
if (!isTabAdded) {
$('#Spreadsheet_Ribbon').ejRibbon({ "selectedItemIndex": 6 })
var ribbonGrp = {
alignType: ej.Ribbon.AlignType.Rows, text: "Screen", content: [{
groups: [{
id: "minmax", toggleButtonSettings: {
contentType: ej.ContentType.TextOnly,
defaultText: "Maximize",
activeText: "Minimize",
width: 120,
height: 50,
click: "onChange"
}
}], defaults: {type: ej.Ribbon.Type.ToggleButton }
}]
};
xlObj.XLRibbon.addTabGroup(6, ribbonGrp, 5);
elemOffset = xlElement.position();
elemPos = xlElement.css("position");
isTabAdded = true;
}
}
</script> |