Modal dialog
Modal dialog
dwacek
Posts: 3Questions: 3Answers: 0
Has anyone ever used modal dialog to show datatable data within on the row click event? If anyone can share what the javascript would look like for a datatable that displays its details in the modal dialog. When I try to show the modal dialog I get a javascript error.
Any help and example would be much appreciated!
This discussion has been closed.
Answers
This is my js :
actionViewSysFormat: function(event) {
var $this = $(event.currentTarget);
$.ajax({
url: $base_url + "table/view_modal",
type: "POST",
// dataType: "JSON",
data: {table_name: $this.attr("table_name"), desc: $this.attr("description")},
async: false,
success: function(response) {
$("#modal_view .modal-content").html(response);
$.validator.addMethod("noSpace", function(value, element) {
return value.indexOf(" ") < 0 && value != "";
}, "No space please and don't leave it empty");
//var desc = $this.attr("description");
var table_name = $this.attr("table_name");
var grid = new Datatable();
grid.init({
src: $("#sample_editable_1"),
dataTable: {
"dom": "<'row'<'col-md-8 col-sm-12'><'col-md-4 col-sm-12'>r>t<'row'<'col-md-12 col-sm-12 footer'pli>>",
"bStateSave": true,
"retrieve": true,
"lengthMenu": [
[10, 20, 50, 100],
[10, 20, 50, 100]
],
"columnDefs": [{ //set default column settings
'orderable': true,
'targets': [0]
}, {
"searchable": true,
"targets": [0]
}],
"pageLength": 10,
"ajax": {
"url": $base_url + "table/list_edittable?table_selected="+table_name,
"type": "POST"
},
"order": []
}
});
}
});