• Basics
  • Abyss
  • Web APIs
  • C# & Razor
  • .net API
  • JS & TS API

    Show / Hide Table of Contents

    Interface CommandCodeParams

    Parameters used for the command code on toolbars (new in v14.4).
    ⤴️ back to All Command Names

    Buttons with Custom Code in a Toolbar

    you are here (click to zoom) - discover the stack

    In some cases you want to add buttons to a toolbar, which run custom JavaScript code.

    How to use v10+

    Here's a basic example showing a 2sxc-toolbar with a custom code:

    @Edit.Toolbar(toolbar: new [] { "toolbar=empty", "custom?call=helloCustom" })
    
    <script>
      function helloCustom(context, event) {
        alert('hello from custom button');
      }
    </script>
    

    For old use, check out the Custom Code in V9 section.

    Read also / Demos / Tutorials

    • commands
    • JS Manage / Toolbar API Tutorial App

    History

    1. Introduced in 2sxc v08.06
    2. Improved with call for v10+

    Package: Api.Js.SxcJs

    Properties

    call

    Name of the function to call - must be available in the context. This is usually as a function window. Example:
    If call is sayHello you need a window.sayHello(params, context, event).

    Declaration
    call: string
    Property Value
    Type Description
    string
    • Improve this Doc
    Back to top Generated by DocFX