diff --git a/media/js/jquery.dataTables.js b/media/js/jquery.dataTables.js index 9caa263d..ad067615 100644 --- a/media/js/jquery.dataTables.js +++ b/media/js/jquery.dataTables.js @@ -1516,7 +1516,7 @@ if ( mSource === null ) { /* Give an empty string for rendering / sorting etc */ - return function (data) { + return function (data, type) { return null; }; } @@ -1535,19 +1535,19 @@ var a = mSource.split('.'); if ( a.length == 2 ) { - return function (data) { + return function (data, type) { return data[ a[0] ][ a[1] ]; }; } else if ( a.length == 3 ) { - return function (data) { + return function (data, type) { return data[ a[0] ][ a[1] ][ a[2] ]; }; } else { - return function (data) { + return function (data, type) { for ( var i=0, iLen=a.length ; iEmpty string + * @private */ "_sRowStripe": "" }; - var modelColumn = { - "sType": null, - "_bAutoType": true, - "bVisible": true, - "bSearchable": true, - "bSortable": true, - "asSorting": [ 'asc', 'desc' ], - "sSortingClass": null, - "sSortingClassJUI": null, - "sTitle": '', - "sName": '', - "sWidth": null, - "sWidthOrig": null, - "sClass": null, - "fnRender": null, - "bUseRendered": true, + + + + /** + * Template object for the column information object in DataTables. This object + * is held in the settings aoColumns array and contains all the information that + * DataTables needs about each individual column. + * + * Note that this object is related to {@link DataTable.models.oInitColumns} + * but this one is the internal data store for DataTables's cache of columns. + * It should NOT be manipulated outside of DataTables. Any configuration should + * be done through the initialisation options. + * @namespace + */ + DataTable.models.oColumn = { + /** + * A list of the columns that sorting should occur on when this column + * is sorted. That this property is an array allows multi-column sorting + * to be defined for a column (for example first name / last name columns + * would benefit from this). The values are integers pointing to the + * columns to be sorted on (typically it will be a single integer pointing + * at itself, but that doesn't need to be the case). + * @type array + * @default [] + */ "aDataSort": [], - "mDataProp": null, + + /** + * Define the sorting directions that are applied to the column, in sequence + * as the column is repeatedly sorted upon - i.e. the first value is used + * as the sorting direction when the column if first sorted (clicked on). + * Sort it again (click again) and it will move on to the next index. + * Repeat until loop. + * @type array + * @default ['asc', 'desc'] + */ + "asSorting": ['asc', 'desc'], + + /** + * Flag to indicate if the column is searchable, and thus should be included + * in the filtering or not. + * @type boolean + * @default true + */ + "bSearchable": true, + + /** + * Flag to indicate if the column is sortable or not. + * @type boolean + * @default true + */ + "bSortable": true, + + /** + * When using fnRender, you have two options for what to do with the data, + * and this property serves as the switch. Firstly, you can have the sorting + * and filtering use the rendered value (true - default), or you can have + * the sorting and filtering us the original value (false). + * + * *NOTE* It is it is advisable now to use mDataProp as a function and make + * use of the 'type' that it gives, allowing (potentially) different data to + * be used for sorting, filtering, display and type detection. + * @type boolean + * @default true + * @deprecated + */ + "bUseRendered": true, + + /** + * Flag to indicate if the column is currently visible in the table or not + * @type boolean + * @default true + */ + "bVisible": true, + + /** + * Flag to indicate to the type detection method if the automatic type + * detection should be used, or if a column type (sType) has been specified + * @type boolean + * @default true + * @private + */ + "_bAutoType": true, + + /** + * Function to get data from a cell in a column. You should never + * access data directly through _aData internally in DataTables - always use + * the method attached to this property. It allows mDataProp to function as + * required. This function is automatically assigned by the column + * initialisation method + * @type function + * @param {array|object} oData The data array/object for the array + * (i.e. aoData[]._aData) + * @param {string} sSpecific The specific data type you want to get - + * 'display', 'type' 'filter' 'sort' + * @returns {*} The data for the cell from the given row's data + * @default null + */ "fnGetData": null, + + /** + * Custom display function that will be called for the display of each cell + * in this column. + * @type function + * @param {object} o Object with the following parameters: + * @param {int} o.iDataRow The row in aoData + * @param {int} o.iDataColumn The column in question + * @param {array o.aData The data for the row in question + * @param {object} o.oSettings The settings object for this DataTables instance + * @returns {string} The string you which to use in the display + * @default null + */ + "fnRender": null, + + /** + * Function to set data for a cell in the column. You should never + * set the data directly to _aData internally in DataTables - always use + * this method. It allows mDataProp to function as required. This function + * is automatically assigned by the column initialisation method + * @type function + * @param {array|object} oData The data array/object for the array + * (i.e. aoData[]._aData) + * @param {*} sValue Value to set + * @default null + */ "fnSetData": null, - "sSortDataType": 'std', - "sDefaultContent": null, - "sContentPadding": "", + + /** + * Property to read the value for the cells in the column from the data + * source array / object. If null, then the default content is used, if a + * function is given then the return from the function is used. + * @type function|int|string|null + * @default null + */ + "mDataProp": null, + + /** + * Unique header TH/TD element for this column - this is what the sorting + * listener is attached to (if sorting is enabled.) + * @type node + * @default null + */ "nTh": null, - "nTf": null + + /** + * Unique footer TH/TD element for this column (if there is one). Not used + * in DataTables as such, but can be used for plug-ins to reference the + * footer for each column. + * @type node + * @default null + */ + "nTf": null, + + /** + * The class to apply to all TD elements in the table's TBODY for the column + * @type string + * @default null + */ + "sClass": null, + + /** + * When DataTables calculates the column widths to assign to each column, + * it finds the longest string in each column and then constructs a + * temporary table and reads the widths from that. The problem with this + * is that "mmm" is much wider then "iiii", but the latter is a longer + * string - thus the calculation can go wrong (doing it properly and putting + * it into an DOM object and measuring that is horribly(!) slow). Thus as + * a "work around" we provide this option. It will append its value to the + * text that is found to be the longest string for the column - i.e. padding. + * @type string + * @default Empty string + */ + "sContentPadding": "", + + /** + * Allows a default value to be given for a column's data, and will be used + * whenever a null data source is encountered (this can be because mDataProp + * is set to null, or because the data source itself is null). + * @type string + * @default null + */ + "sDefaultContent": null, + + /** + * Name for the column, allowing reference to the column by name as well as + * by index (needs a lookup to work by name). + * @type string + * @default Empty string + */ + "sName": '', + + /** + * Custom sorting data type - defines which of the available plug-ins in + * afnSortData the custom sorting will use - if any is defined. + * @type string + * @default std + */ + "sSortDataType": 'std', + + /** + * Class to be applied to the header element when sorting on this column + * @type string + * @default null + */ + "sSortingClass": null, + + /** + * Class to be applied to the header element when sorting on this column - + * when jQuery UI theming is used. + * @type string + * @default null + */ + "sSortingClassJUI": null, + + /** + * Title of the column - what is seen in the TH element (nTh). + * @type string + * @default Empty string - automatically detected + */ + "sTitle": '', + + /** + * Column sorting and filtering type + * @type string + * @default null + */ + "sType": null, + + /** + * Width of the column + * @type string + * @default null + */ + "sWidth": null, + + /** + * Width of the column when it was first "encountered" + * @type string + * @default null + */ + "sWidthOrig": null }; + DataTable.ext = {}; diff --git a/media/src/core/core.data.js b/media/src/core/core.data.js index e2522be1..56315af5 100644 --- a/media/src/core/core.data.js +++ b/media/src/core/core.data.js @@ -364,7 +364,7 @@ function _fnGetObjectDataFn( mSource ) if ( mSource === null ) { /* Give an empty string for rendering / sorting etc */ - return function (data) { + return function (data, type) { return null; }; } @@ -383,19 +383,19 @@ function _fnGetObjectDataFn( mSource ) var a = mSource.split('.'); if ( a.length == 2 ) { - return function (data) { + return function (data, type) { return data[ a[0] ][ a[1] ]; }; } else if ( a.length == 3 ) { - return function (data) { + return function (data, type) { return data[ a[0] ][ a[1] ][ a[2] ]; }; } else { - return function (data) { + return function (data, type) { for ( var i=0, iLen=a.length ; iEmpty string + * + * @example + * // Using aoColumns + * $(document).ready(function() { + * $('#example').dataTable( { + * "aoColumns": [ + * null, + * null, + * null, + * { + * "sContentPadding": "mmm" + * } + * ] + * } ); + * } ); + */ + "sContentPadding": "", /** diff --git a/media/src/model/model.init.js b/media/src/model/model.init.js index 419e8d1b..2607ede3 100644 --- a/media/src/model/model.init.js +++ b/media/src/model/model.init.js @@ -1,7 +1,7 @@ /** - * Initilaisation options that can be given to DataTables at initialisation + * Initialisation options that can be given to DataTables at initialisation * time. * @namespace */ @@ -864,7 +864,7 @@ DataTable.models.oInit = { * pairs) that has been constructed by DataTables and will be sent to the * server. In the case of Ajax sourced data with server-side processing * this will be an empty array, for server-side processing there will be a - * significant number of parameters!. + * significant number of parameters! * @returns {undefined} Ensure that you modify the aoData array passed in, * as this is passed by reference. * @@ -1070,7 +1070,7 @@ DataTable.models.oInit = { /** * All strings that DataTables uses in the user interface that it creates - * are defined in this object, allowing you to modifed them individually or + * are defined in this object, allowing you to modified them individually or * completely replace them all as required. * @namespace */ diff --git a/media/src/model/model.row.js b/media/src/model/model.row.js index 95c911d3..f88ec698 100644 --- a/media/src/model/model.row.js +++ b/media/src/model/model.row.js @@ -3,7 +3,7 @@ /** * Template object for the way in which DataTables holds information about - * each indivudal row. This is the object format used for the settings + * each individual row. This is the object format used for the settings * aoData array. * @namespace */ @@ -16,8 +16,8 @@ DataTable.models.oRow = { "nTr": null, /** - * Data object from the original data sorce for the row. This is either - * an array if using the tranditional form of DataTables, or an object if + * Data object from the original data source for the row. This is either + * an array if using the traditional form of DataTables, or an object if * using mDataProp options. The exact type will depend on the passed in * data from the data source, or will be an array if using DOM a data * source. @@ -27,7 +27,7 @@ DataTable.models.oRow = { "_aData": [], /** - * Sorting data cache - this array is obstensibily the same length as the + * Sorting data cache - this array is ostensibly the same length as the * number of columns (although each index is generated only as it is * needed), and holds the data that is used for sorting each column in the * row. We do this cache generation at the start of the sort in order that @@ -36,6 +36,7 @@ DataTable.models.oRow = { * other than the master sorting methods. * @type array * @default [] + * @private */ "_aSortData": [], @@ -47,6 +48,7 @@ DataTable.models.oRow = { * undefined or null. * @type array nodes * @default [] + * @private */ "_anHidden": [], @@ -56,6 +58,7 @@ DataTable.models.oRow = { * on className for the nTr property. * @type string * @default Empty string + * @private */ "_sRowStripe": "" };