From 33c4867ef26ad36a649cb321e05cb94fde2db29a Mon Sep 17 00:00:00 2001 From: Nick Date: Sun, 15 Jan 2017 12:23:24 +0000 Subject: [PATCH] Update sliding-child.js Added example usage comment --- features/slidingChild/js/sliding-child.js | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/features/slidingChild/js/sliding-child.js b/features/slidingChild/js/sliding-child.js index d6ff88e..86fde8d 100644 --- a/features/slidingChild/js/sliding-child.js +++ b/features/slidingChild/js/sliding-child.js @@ -2,12 +2,27 @@ * @summary SlidingChild * @description Plug-in to show/hide row child data * @version 1.0.0 - * @file datatables-slidingchild.js + * @file slidingchild.js * @author datahandler (www.datahandler.uk) * @copyright Copyright 2014 SpryMedia Ltd. * * 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 ($) { var SlidingChild = function (dt, options) { var opts = $.extend({}, SlidingChild.defaults, options); @@ -57,8 +72,8 @@ type: opts.ajax.requestType, url: opts.ajax.requestUrl, beforeSend: function(xhr, settings) { - if (opts.ajax.requestData) { - this.data = opts.ajax.requestData(dtRow); + if (opts.ajax.requestDataCallback) { + this.data = opts.ajax.requestDataCallback(dtRow); } }, contentType: opts.ajax.contentType, @@ -99,7 +114,7 @@ useRowData: false, ajax: { requestType: "GET", - requestData: null, + requestDataCallback: null, requestUrl: null, contentType: "application/json; charset=utf-8", dataType: "json"