Previously, for the delete operation, we used the general "Confirm deletion" method written by the head.
The Code is as follows:
// Display the confirmation dialog box
Function showConfirm (txtTitle, txtMsg, callback ){
GetDivDialog (). text (txtMsg). dialog ({
Modal: true
, Overlay :{
Opacity: 0.5
}
, Title: txtTitle
, Buttons :{
"Yes": function (){
Callback ();
$ (This). dialog ("close ");
}
, "No": function (){
$ (This). dialog ("close ");
}
}
});
}
However, when using ui.1.7.1, The click Event of each button can only display the dialog once. Speechless...
There is no explanation for viewing the official documentation. Google once found that in ui.1.7.1, dialog must be initialized first.
In document. ready (function (){
// Initialize dialog
})
The Code is as follows:
$ ("# Layout-confirm"). dialog ({
AutoOpen: false,
Modal: true,
Title: "delete"
});
Note the following points:
Because some dialog parameters are passed in variables, you must first append option and then open
Sample Code:
The Code is as follows:
DelText. click (function (){
$ ("# Layout-confirm"). dialog (
'Option'
, 'Buttons'
,{
"OK": function (){
If (file. type = 0 ){
DeleteFolder (file. path );
}
Else {
DeleteFile (file. path );
}
}
, "Cancel": function (){
$ (This). dialog ("close ");
}
}
);
$ ("# Layout-confirm"). dialog ("open ");
});
OK ~~