- Home
- Forum
- ASP.NET MVC
- Ribbon Enabled But Minimized
Ribbon Enabled But Minimized
|
<div id="Spreadsheet"></div>
$(function () {
$("#Spreadsheet").ejSpreadsheet({
//...
loadComplete: "onLoadComplete"
});
});
function onLoadComplete(args) {
//Collapse ribbon option
$("#" + this._id + "_Ribbon").data("ejRibbon").collapse();
}
|
Hi Silambarasan,
Thank you, but it did not work on my end. Here is what I have:
@(Html.EJ().Spreadsheet<object>("Spreadsheet")
.AllowEditing(true)
.AllowImport(true)
.AllowInsert(true)
.ColumnWidth(100)
.AllowResizing(true)
.AllowFreezing(true)
.AllowFormulaBar(true)
.ShowRibbon(true).RibbonSettings(x => x.EnableOnDemand(true))
.EnableContextMenu(true)
.ScrollSettings(scroll => { scroll.Height(580); })
.ExportSettings(x => x.AllowExporting(true))
.ImportSettings(import =>
{
import.ImportOnLoad(Model.ExcelData != null);
import.ImportMapper(Url.Action("ImportXls", "ExcelData"));
})
.ClientSideEvents(x=>x.LoadComplete("onLoadComplete"))
)
then I have a script:
$(function() {
$("#saveXls").bind("click",
function() {
function onLoadComplete(args) {
$("#Spreadsheet_Ribbon").data("ejRibbon").collapse(); }
});
I also tried $("#" + this._id + "_Ribbon").data("ejRibbon").collapse();
but that did not work either. I see that your example is working. So the question is what is the difference between the MVC extension and the js plugin.
Thanks for all your help.
On a different note, how do you paste code with formatting in this editor? I like how your code looks, nice and formatted.
|
@(Html.EJ().Spreadsheet<object>("Spreadsheet")
//...
.ClientSideEvents(x => x.LoadComplete("onLoadComplete"))
)
<script type="text/javascript">
//$(function () {
// $("#saveXls").bind("click", function () {
// function onLoadComplete(args) {
// $("#Spreadsheet_Ribbon").data("ejRibbon").collapse();
// }
// });
//});
//onLoadComplete function should be defined outside of document.ready function & it should be available in window scope.
function onLoadComplete(args) {
$("#Spreadsheet_Ribbon").data("ejRibbon").collapse();
}
</script>
|
- Open MS word document or Outlook, then edit code Which format you want to paste.
- Copy the code from Visual studio and paste in word file or outlook.
- Then copy the code from MS word and past it into our text editor. Please find below screenshot.
Thank you for the information. It worked beautifully. The key was this;
//onLoadComplete function should be defined outside of document.ready function & it should be available in window scope.
Thank you for the formatting tip too.
- 6 Replies
- 2 Participants
-
SY syntax
- Aug 10, 2017 06:50 AM UTC
- Aug 16, 2017 04:36 AM UTC