Javascript jQuery引导网格模式对话框
我有一个jQuery引导网格,如主页上的示例所述。在最后一列中,我有两个用于编辑/删除行内容的按钮 我只想在用户单击Delete按钮时显示一个模式对话框。但是,单击时不会发生任何事情。没有错误,没有警告,什么都没有 以下是bootgrid命令部分的代码:Javascript jQuery引导网格模式对话框,javascript,jquery,jquery-plugins,bootstrap-modal,jquery-bootgrid,Javascript,Jquery,Jquery Plugins,Bootstrap Modal,Jquery Bootgrid,我有一个jQuery引导网格,如主页上的示例所述。在最后一列中,我有两个用于编辑/删除行内容的按钮 我只想在用户单击Delete按钮时显示一个模式对话框。但是,单击时不会发生任何事情。没有错误,没有警告,什么都没有 以下是bootgrid命令部分的代码: "commands": function(column, row) { return "<button type=\"button\" class=\"btn btn-sm btn-primary comm
"commands": function(column, row) {
return "<button type=\"button\" class=\"btn btn-sm btn-primary command-edit\" data-row-id=\"" + row.EventId + "\"><span class=\"icon glyphicon glyphicon-pencil\"></span>@Translator.TranslateGlobal(Keys.Global.Edit)</button> " +
"<button class=\"btn-default btn\" data-content-close=\"Close\" data-content-id=\"Div\" data-content-save=\"Save\" data-target=\"#6698CB2F-2948-45D9-8902-2C13A7ED6335\" data-title=\"Title\" data-toggle=\"modal\" type=\"button\">Show modal</button>";
},
“命令”:函数(列、行){
返回“@Translator.TranslateGlobal(key.Global.Edit)”+
“显示模态”;
},
我在bootgrid外有一个完全相同的按钮,单击它会显示预期的对话框。有什么想法可以看在哪里或者是什么导致了这种行为吗?点击事件打开模式
格式化程序:{
“命令”:功能(列、行){
返回“”+
"";
}
}
}).on(“loaded.rs.jquery.bootgrid”,函数(){
/*在加载和呈现数据后执行*/
$(此)。查找(“.command delete”)。单击(函数(e){
$($(this.attr(“数据目标”)).modal(“显示”);
});
});
希望它能起作用:)这是个好主意,请你用脚本的形式展示一下好吗。我们可以替换脚本的哪一部分 这样,如果网格分页,您就不必重新应用处理程序,而且事件处理程序的数量也少了很多(效率更高):$('table')。在(“click”、“.command delete”上,函数(e){console.log('your stufacts here');});-菲律宾6月26日
formatters: {
"commands": function (column, row) {
return "<button type=\"button\" class=\"btn btn-xs btn-default command-edit\" data-toggle=\"modal\" data-target=\"#confirmation\"><span class=\"fa fa-pencil\"></span></button> " +
"<button type=\"button\" class=\"btn btn-xs btn-default command-delete\" ><span class=\"fa fa-trash-o\"></span></button>";
}
}
}).on("loaded.rs.jquery.bootgrid", function () {
/* Executes after data is loaded and rendered */
$(this).find(".command-delete").click(function (e) {
$($(this).attr("data-target")).modal("show");
});
});
格式化程序:{
“命令”:功能(列、行){
返回“”+
"";
}
}
}).on(“loaded.rs.jquery.bootgrid”,函数(){
/*在加载和呈现数据后执行*/
$(此)。查找(“.command delete”)。单击(函数(e){
$($(this.attr(“数据目标”)).modal(“显示”);
});
});
在每行上放置一个单击处理程序。您最好在表本身上放置一个,然后过滤从一行冒出的任何单击。这样,如果网格分页,您就不必重新应用处理程序,而且事件处理程序的数量也少了很多(效率更高):$('table')。在(“click”、“.command delete”上,函数(e){console.log('your stuff think');});我尝试了以下方法,它确实会在jquery.bootgrid中显示按钮,但按钮没有响应。
formatters: {
"commands": function (column, row) {
return "<button type=\"button\" class=\"btn btn-xs btn-default command-edit\" data-toggle=\"modal\" data-target=\"#confirmation\"><span class=\"fa fa-pencil\"></span></button> " +
"<button type=\"button\" class=\"btn btn-xs btn-default command-delete\" ><span class=\"fa fa-trash-o\"></span></button>";
}
}
}).on("loaded.rs.jquery.bootgrid", function () {
/* Executes after data is loaded and rendered */
$(this).find(".command-delete").click(function (e) {
$($(this).attr("data-target")).modal("show");
});
});