open telerik editor table wizard using jquery in an event

102 views Asked by At

I am going to implement a shortcut for table wizard in telerik editor. I am using asp.net core and have something like:

            @(Html.Kendo().EditorFor(m => m.Summary)
                  .HtmlAttributes(new {style = "width: 100%", required = "required"})
                  .Resizable(resizable => resizable.Content(true).Toolbar(false))
                  .Events(e => e.Keydown("onKeyDown"))
                  .Tools(tools => tools
                      .Clear()
                      .Formatting()
                      .FontName(x => x
                      .TableEditing()
                  ))

I searched a lot but couldn't find a proper solution.

I have created an event like this:

 function onKeyDown(e) {
        if (e.altKey && e.keyCode === 87 /* w */) {
            // not sure how to trigger the wizard here
        }
    }

Any thoughts?

1

There are 1 answers

0
Arash EM On BEST ANSWER

The only workaround I found is to use jquery to click the link to open the wizard:

function onKeyDown(e) {
    if (e.altKey && e.keyCode === 87 /* w */) {
        if (e && e.sender && e.sender.element && e.sender.element.length > 0) {
            var wizard = $(".k-tool[title = 'Table Wizard']");
            if (wizard && wizard.length >= 2) {
                wizard[1].click();
            }
        }
    }
}

I am not sure, this is the best solution, but it works for me. I am still keen to know how to do it properly.