First Commit
This commit is contained in:
1 parent
5eb9dd037d
commit
2e62c0e60b
11877 files changed
+2035312
No files matched your search
@@ -0,0 +1,64 @@
|
||||
|
||||
//
|
||||
// Function to load dynamic data into a div named "dynamic-table-div" using ajax.DataTable.Fetch.php
|
||||
//
|
||||
function loadDynamicData(table_name,action,sequence_flag,table_id,data_div,custom_data,oncomplete_func) {
|
||||
var screenDiv = "dynamic-table-div";
|
||||
if (data_div.length > 0) screenDiv = data_div;
|
||||
|
||||
$("#"+screenDiv).html("<p><b>Loading...</b></p>");
|
||||
$("#"+screenDiv).html("<p><img src='images/spinner2.gif' height=84 width=84></p>");
|
||||
|
||||
// Format parameters
|
||||
var data = "table_name="+table_name+
|
||||
"&sequence_flag="+sequence_flag+
|
||||
"&action="+action+
|
||||
"&table_id="+table_id+
|
||||
custom_data;
|
||||
|
||||
// Get data table
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "ajax.DataTable.Fetch.php",
|
||||
contentType: "application/x-www-form-urlencoded; charset=utf-8",
|
||||
dataType: "json",
|
||||
data: data,
|
||||
success: function(results) {
|
||||
$("#"+screenDiv).html(results.content);
|
||||
if ($('.top-insert-button') && results.num_records > 10) $('.top-insert-button').show();
|
||||
|
||||
if (sequence_flag == 'Y') {
|
||||
$("#"+table_id).tableDnD({
|
||||
onDrop: function(table, row) {
|
||||
var rows = table.tBodies[0].rows;
|
||||
var data = "&table="+table_name;
|
||||
for (var i=0; i<rows.length; i++) {
|
||||
if (rows[i] && rows[i].id) {
|
||||
var rowid = rows[i].id;
|
||||
data += "&row_ids[]="+rowid;
|
||||
|
||||
// Update row classes
|
||||
$("#"+rowid).removeClass();
|
||||
if (i % 2) $("#"+rowid).addClass("data-even");
|
||||
else $("#"+rowid).addClass("data-odd");
|
||||
}
|
||||
}
|
||||
$.ajax({
|
||||
url: "ajax.SequenceRecords.php",
|
||||
data: data
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
if ($.isFunction(oncomplete_func)) {
|
||||
oncomplete_func();
|
||||
}
|
||||
},
|
||||
error: function(jqxhr, textStatus, error) {
|
||||
var err = textStatus + ", " + error;
|
||||
alert("JSON Failure "+err);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user