我试图将sweetalert.js添加到我的项目中。一旦用户点击刷新按钮,就会弹出一个对话框,要求确认,如果是,则应该执行操作,否则,只需关闭对话框而不做任何操作。
到目前为止,我已经发挥了作用:
Dim cn As adodb.Connection
Dim oRs As adodb.Recordset
Set cn = CreateObject("ADODB.Connection")
DBPath = "C:\[databse path]" & "\[database name].accdb"
dbWs = "[excel sheet name]"
scn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & DBPath
dsh = "[" & "[excel sheet name]" & "$]"
cn.Open scn
Dim sSQL As String
Dim F As Integer
sSQL = "Select 'W',a.[Subledger],NULL,sum(a.[Amount]) from GL_Table a where a.[Opex_Group] = 10003 and year(a.[G/L Date]) = " & Year(Sheets("Repairs").Cells(1, 4)) & " and month(a.[G/L Date]) = " & Month(Sheets("Repairs").Cells(1, 4))
sSQL = sSQL & " group by " & "a.[Subledger],(year(a.[G/L Date])),(month(a.[G/L Date]))"
Set oRs = cn.Execute(sSQL)
Debug.Print oRs.RecordCount
oRs.Close
....... further code to print to excel here
cn.Close
End Sub`
我在这里叫它
function refresh() {
swal({
title: "",
type: "warning",
text: "Do you want to proceed?",
confirmButtonText: "Yes",
cancelButtonText: "No"
showCancelButton: true,
closeOnConfirm: true,
});
但是当我点击按钮时,它只显示对话框几秒钟,对话框消失并自动刷新。单击取消或确认按钮时也是如此。
答案 0 :(得分:0)
我对此设置没有任何问题。确保您已完成所有操作,例如,您的配置中缺少逗号。 看看我的小提琴:https://jsfiddle.net/04awn537/
(function() {
'use strict';
var app = angular.module('app');
app.directive('dynamicView', ['$http', 'HttpService', 'Toastr', '$log', '$document',
function($http, HttpService, Toastr, $log, $document) {
return {
restrict: 'E',
replace: true,
templateUrl: 'app/directives/dynamic-view.directive.html',
scope: {
config: '='
},
link: function(scope, element) {
scope.isMultiSelectVisible = false;
scope.toggleMultiSelect = function(){
scope.isMultiSelectVisible = !scope.isMultiSelectVisible;
}
element.on('click', function(event) {
console.log("Buton Click");
event.stopPropagation();
});
$document.on('click', function(){
console.log("Other Click");
scope.isMultiSelectVisible = false;
scope.$apply();
});
}
}
}
]);
})();