Update sliding-child.js

Made some minor naming changes for clarity
pull/315/head
Nick 8 years ago committed by GitHub
parent bf6d86d424
commit 0edd41aadd

@ -1,6 +1,6 @@
/** /**
* @summary SlidingChild * @summary SlidingChild
* @description Show/Hide row child data plug-in * @description Plug-in to show/hide row child data
* @version 1.0.0 * @version 1.0.0
* @file datatables-slidingchild.js * @file datatables-slidingchild.js
* @author datahandler (www.datahandler.uk) * @author datahandler (www.datahandler.uk)
@ -43,7 +43,7 @@
$(opts.sliderSelector, dtRow.child()).slideUp(function () { $(opts.sliderSelector, dtRow.child()).slideUp(function () {
dtRow.child.remove(); dtRow.child.remove();
showingRow.removeClass('shown'); showingRow.removeClass('shown');
$(dt.table().node()).trigger('rowClosed', [dtRow]); $(dt.table().node()).trigger('childClosed', [dtRow]);
}); });
} }
}; };
@ -57,16 +57,16 @@
type: opts.ajax.requestType, type: opts.ajax.requestType,
url: opts.ajax.requestUrl, url: opts.ajax.requestUrl,
beforeSend: function(xhr, settings) { beforeSend: function(xhr, settings) {
if (opts.ajax.getRequestData) { if (opts.ajax.requestData) {
this.data = opts.ajax.getRequestData(dtRow); this.data = opts.ajax.requestData(dtRow);
} }
}, },
contentType: opts.ajax.contentType, contentType: opts.ajax.contentType,
dataType: opts.ajax.dataType, dataType: opts.ajax.dataType,
success: function (response) { success: function (response) {
var data = response; var data = response;
if (opts.dataCallback) { if (opts.dataFormatCallback) {
data = opts.dataCallback(response); data = opts.dataFormatCallback(response);
} }
showChild(dtRow, data); showChild(dtRow, data);
}, },
@ -76,8 +76,8 @@
}; };
var showChildDataFromRow = function(dtRow) { var showChildDataFromRow = function(dtRow) {
if (!opts.dataCallback) { return; } // throw error? if (!opts.dataFormatCallback) { return; } // throw error?
var data = opts.dataCallback(dtRow.data()); var data = opts.dataFormatCallback(dtRow.data());
showChild(dtRow, data); showChild(dtRow, data);
} }
@ -88,7 +88,7 @@
$(opts.sliderSelector, dtRow.child()).slideDown(function () { $(opts.sliderSelector, dtRow.child()).slideDown(function () {
selectedRow.addClass('shown'); selectedRow.addClass('shown');
$(dt.table().node()).trigger('rowShown', [dtRow]); $(dt.table().node()).trigger('childShown', [dtRow]);
}); });
}; };
}; };
@ -104,7 +104,7 @@
contentType: "application/json; charset=utf-8", contentType: "application/json; charset=utf-8",
dataType: "json" dataType: "json"
}, },
dataCallback: null, dataFormatCallback: null,
sliderSelector: 'div.slider' sliderSelector: 'div.slider'
}; };

Loading…
Cancel
Save