简体   繁体   English

Kendo 向 Aurelia 确认 jQuery

[英]Kendo confirm jQuery to Aurelia

I'm trying to re-order the buttons on a KendoUI confirm dialog.我正在尝试重新排序 KendoUI 确认对话框上的按钮。 Telerik support supplied a jQuery example, but I can't seem to get the syntax in Aurelia correct. Telerik 支持提供了一个 jQuery 示例,但我似乎无法正确使用 Aurelia 中的语法。

I have this, which lets me put the buttons in the order I want:我有这个,这让我可以按我想要的顺序放置按钮:


  
 
  
  
  
        confirm(message: string, title?: any): JQueryPromise<any> {        
            message = this.javaScriptCommentToHTML(message);
            title = this.checkForTitle(title);
            let dialog = $('<div></div>').appendTo(document.body);
            let kConfirm: kendo.ui.Confirm;
            let options: any = {
                buttonLayout: 'normal',
                title: title,
                content: message,
                actions: [
                    {
                        text: "Cancel",
                        primary: false,
                        cssClass: "k-button-cancel",
                        action: function (e) {
                            //  What goes here to trigger cancel action???
                        }
                    },
                    {
                        text: "OK",
                        primary: true,
                        cssClass: "k-button-ok",
                        action: function (e) {
                            //  What goes here to trigger OK action???
                        }
                    }
                ],
                close: function (e) {
                    kConfirm.wrapper.remove();
                }
            };
            kConfirm = dialog.kendoConfirm(options).data('kendoConfirm');
            kConfirm.open();
            return kConfirm.result;
        }

But I don't know what to put in the button action to trigger the default "OK" and "Cancel" actions.但我不知道在按钮动作中放什么来触发默认的“确定”和“取消”动作。 The sample Telerik is this, but they are using a "secondaryButtonCloseFunction" and "primaryButtonCloseFunction" which I can't get Aurelia to recognize. Telerik 示例就是这样,但他们使用的是“secondaryButtonCloseFunction”和“primaryButtonCloseFunction”,我无法让 Aurelia 识别。


  
 
  
  
  
           function showConfirm(message, options) {
              if (options === undefined) {
                options = new Object();
              }
              var dialog = $("#confirm-dialog");
              dialog.kendoDialog({
                closable: false,
                content: message,
                title: options.title || 'Confirm',
                width: options.width || 400,
                height: options.height || 200,
                modal: true,
                buttonLayout: "normal",
                actions: [{
                  text: options.secondaryButtonText || 'Cancel',
                  action: options.secondaryButtonCloseFunction || function () { 
                    alert("No clicked")
                  }
                },
                {
                  text: options.primaryButtonText || 'OK',
                  action: options.primaryButtonCloseFunction || function () { 
                    alert("Yes clicked")
                  },
                  primary: true
                }]
              });
              dialog.data("kendoDialog").open();
            }

Their example uses a generic Object for "options" and I tried declaring a separate object to contain those "xxButtonCloseFunction" properties which gets me past Aurelia compile errors, but it doesn't do anything.他们的示例使用通用对象作为“选项”,我尝试声明一个单独的对象来包含那些“xxButtonCloseFunction”属性,这使我克服了 Aurelia 编译错误,但它没有做任何事情。

thanks!谢谢!

Telerik came back with a CSS solution to switch the button order. Telerik 带来了一个 CSS 解决方案来切换按钮顺序。 Maybe this will be useful to someone else!也许这对其他人有用!

.k-dialog-buttongroup .k-button:first-child {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
display: flex;
justify-content: flex-end;
}
.k-dialog-buttongroup .k-button:last-child {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    order: -1;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM