This is a migrated thread and some comments may be shown as answers.

Toolbar custom definition not implemented

4 Answers 153 Views
Spreadsheet
This is a migrated thread and some comments may be shown as answers.
Jan
Top achievements
Rank 1
Jan asked on 15 May 2017, 08:28 AM

Hello,

I want to define which buttons are displayed in the toolbar in which not. In Kendo its possible by passing arrays to the sections of the toolbar (Home, Insert, Data). In .NET Core I am configurating the toolbar in my CSHTML file and can only pass booleans to the sections i.e. .Toolbar(t => t.Home(true).Data(false).Insert(false))

Btw. the documentation has a wrong description here: http://docs.telerik.com/aspnet-mvc/api/Kendo.Mvc.UI.Fluent/SpreadsheetBuilder#methods-Toolbar(System.Action%3CKendo.Mvc.UI.Fluent.SpreadsheetToolbarSettingsBuilder%3E) because it says I should pass a boolean (maybe just copied from the .Toolbar() above).

When I change the option after init in Javascript with "...options.toolbar.home = [['bold', 'italic'], 'format'];", the spreadsheet is not updated.

I really need a solution for this asap.

4 Answers, 1 is accepted

Sort by
0
Ianko
Telerik team
answered on 17 May 2017, 12:36 PM

Hello Jan,

This is a logged bug, which you can monitor from here: https://github.com/telerik/kendo-ui-core/issues/2905

For the time being, the only possible option to define the tools in the Toolbar is by destroying and recreating the Spreadsheet on the client:

@(Html.Kendo().Spreadsheet()
    .Name("spreadsheet")
)
  
<script>
    $(document).ready(function () {
        var spreadsheet = $("#spreadsheet").data("kendoSpreadsheet");
        var options = spreadsheet.options;
        spreadsheet.destroy();
        $("#spreadsheet").html("");
        $("#spreadsheet").kendoSpreadsheet($.extend({ toolbar: { insert: false } }), options);
    });
</script>

Regards,
Ianko
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Jan
Top achievements
Rank 1
answered on 22 May 2017, 07:41 AM

You have a syntax error in your code. Just for others who need this, here the correct workaround:

@(Html.Kendo()
    .Spreadsheet()
    .Name("spreadsheet")
)
 
<script>
  $(function () {
    var $ss =  $('#spreadsheet');
    var ss = $ss.data('kendoSpreadsheet');
    var options = ss.options;
    ss.destroy();
    var ssNew = $ss.empty()
      .kendoSpreadsheet($.extend(options, {
        toolbar: {
          home: [['bold', 'italic', 'underline']],
          insert: false,
          data: false
        }
      }))
      .data('kendoSpreadsheet');
  });
</script>
0
Ivan Danchev
Telerik team
answered on 24 May 2017, 08:05 AM
Hello Jan,

Thank you for pointing this out. We updated the workaround posted in the Github repo.

Regards,
Ivan Danchev
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Richard
Top achievements
Rank 1
answered on 15 Nov 2017, 07:21 PM

For reference, Alexander Valchev posted the default spreadsheet toolbar configuration in this post

 

Tags
Spreadsheet
Asked by
Jan
Top achievements
Rank 1
Answers by
Ianko
Telerik team
Jan
Top achievements
Rank 1
Ivan Danchev
Telerik team
Richard
Top achievements
Rank 1
Share this question
or