Update sliding-child.js

Added example usage comment
pull/315/head
Nick 8 years ago committed by GitHub
parent 0edd41aadd
commit 33c4867ef2

@ -2,12 +2,27 @@
* @summary SlidingChild * @summary SlidingChild
* @description Plug-in to show/hide row child data * @description Plug-in to show/hide row child data
* @version 1.0.0 * @version 1.0.0
* @file datatables-slidingchild.js * @file slidingchild.js
* @author datahandler (www.datahandler.uk) * @author datahandler (www.datahandler.uk)
* @copyright Copyright 2014 SpryMedia Ltd. * @copyright Copyright 2014 SpryMedia Ltd.
* *
* License MIT - http://datatables.net/license/mit * License MIT - http://datatables.net/license/mit
*/ */
/**
* Example usage
* @example
* var table = $('#table_id').DataTable();
* slidingChild =
* new $.fn.dataTable.SlidingChild(table, {
* ajax: {
* requestType: 'POST',
* requestUrl: '/Home/GetChildData',
* dataType: 'HTML',
* requestDataCallback: myRequestDataCallback
* }
* });
*/
(function ($) { (function ($) {
var SlidingChild = function (dt, options) { var SlidingChild = function (dt, options) {
var opts = $.extend({}, SlidingChild.defaults, options); var opts = $.extend({}, SlidingChild.defaults, options);
@ -57,8 +72,8 @@
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.requestData) { if (opts.ajax.requestDataCallback) {
this.data = opts.ajax.requestData(dtRow); this.data = opts.ajax.requestDataCallback(dtRow);
} }
}, },
contentType: opts.ajax.contentType, contentType: opts.ajax.contentType,
@ -99,7 +114,7 @@
useRowData: false, useRowData: false,
ajax: { ajax: {
requestType: "GET", requestType: "GET",
requestData: null, requestDataCallback: null,
requestUrl: null, requestUrl: null,
contentType: "application/json; charset=utf-8", contentType: "application/json; charset=utf-8",
dataType: "json" dataType: "json"

Loading…
Cancel
Save