Reputation: 2645
I am playing with bootstrap-table and bootstrap-dialog.
When I click in a row I need to show a dialog with bootstrapDialog. This is working well.
If I click on "Yes" I need execute some code and close the window. If CI lick "No", I only close the window.
My problem is when I click Yes, an alert function is called but the dialog is never closed. I need to close the dialog automatically after return from called function.
What am I missing here?
Here is link to test: http://jsfiddle.net/aoh4yamr/10/
var data = [
{
"name": "bootstrap-table",
"stargazers_count": "526",
"forks_count": "122",
"description": "An extended Bootstrap table with radio, checkbox, sort, pagination, and other added features. (supports twitter bootstrap v2 and v3) "
},
{
"name": "multiple-select",
"stargazers_count": "288",
"forks_count": "150",
"description": "A jQuery plugin to select multiple elements with checkboxes :)"
},
{
"name": "bootstrap-show-password",
"stargazers_count": "32",
"forks_count": "11",
"description": "Show/hide password plugin for twitter bootstrap."
},
{
"name": "blog",
"stargazers_count": "13",
"forks_count": "4",
"description": "my blog"
},
{
"name": "scutech-redmine",
"stargazers_count": "6",
"forks_count": "3",
"description": "Redmine notification tools for chrome extension."
}
];
$(function () {
$('#table').bootstrapTable({
data: data
});
});
function commonFormatter(value) {
return '<div data-field="' + this.field + '">' + value + '</div>';
}
window.commonEvents = {
'click div': function (e) {
function doFunctionEditForYes() {
alert("ok");
};
BootstrapDialog.show({
title: 'Hello',
message: 'Edit?',
buttons: [ {
label: 'Yes',
cssClass: 'btn-success',
action: function(dialogRef) {
doFunctionEditForYes();
dialogRef.close;
}
}, {
label: 'No',
cssClass: 'btn-warning',
action: function(dialogItself){
dialogItself.close();
}
}]
});
}
}
Upvotes: 0
Views: 1575
Reputation: 339
You are just using dialogRef.close
buttons: [ {
label: 'Yes',
cssClass: 'btn-success',
action: function(dialogRef) {
doFunctionEditForYes();
dialogRef.close;
}
it should be dialogRef.close();
buttons: [ {
label: 'Yes',
cssClass: 'btn-success',
action: function(dialogRef) {
doFunctionEditForYes();
dialogRef.close();
}
You're missing the () only - almost had it
updated fiddle http://jsfiddle.net/xh3xhgb3/
Upvotes: 2