1
0
mirror of https://github.com/DataTables/DataTables.git synced 2024-11-29 11:24:10 +01:00
Commit Graph

643 Commits

Author SHA1 Message Date
Allan Jardine
6e012c8ee1 Dev fix: Thousands separator was incorrectly applied
- This was from my old work on experimenting with removing hugraian
  notation, it slipped through to be committed.
2013-02-16 11:33:50 +00:00
Allan Jardine
f3ce2e2d44 Fix 151: Column type was being offset when columns were not searchable 2013-02-16 11:27:41 +00:00
Allan Jardine
d5fb56ff37 Update: Update to jQuery 1.9.1 2013-02-16 11:26:54 +00:00
Allan Jardine
39ad1e7004 Dev: Small size reduction in SSP parameter build
- Saving of just 269 bytes in minified file, but non-the-less welcome
2013-02-10 12:18:00 +00:00
Allan Jardine
28c60e92a6 Dev fix: Undefined variable (JSHint) 2013-02-10 12:17:39 +00:00
Allan Jardine
2b6788011f New: ajax parameter to control all aspects of Ajax that DataTables uses
- DataTables 1.9 had 5 different parameters that controlled how Ajax
  data was obtained, which with its own naming properties, often mapping
  to the jQuery.ajax methods, or otherwise extending them. To hugely
  simply and extend the Ajax functionality DataTables has, these five
  parameters have now been deprecated and the funtionality provided by
  them merged into the new `ajax` parameter.

- Deprecated properties:
   - sAjaxSource
   - fnServerData
   - sAjaxDataProp
   - sServerMethod
   - fnServerParams

- Note that these parameters are still fully supported and can be used,
  but for new projects, `ajax` should be used as they will eventually be
  removed (likely DataTables v2 whenever that is, as they are too widely
  used to be removed in v1.x).

- Added additional / missing tests for the deprecated properties to
  ensure full backwards compatiblity

- The new `ajax` property is fully documented in the doc comments, but
  as a summary it can take three forms:
   - string - the url to get the data from (i.e. this is the new
     sAjaxSource)
   - object - maps directly to jQuery.ajax, allowing full control of the
     Ajax call (provides the abilities of fnServerParams, sServerMethod,
     sAjaxDataProp)
   - function - a function so you can get the data your own way
     (provides the abilities of fnServerData)

- Added unit tests for the new `ajax` property and doc comment examples
  updated to use this property exclusively.
2013-02-10 11:58:58 +00:00
Allan Jardine
fad7536608 Fix: $().andSelf() was deprecated in jQuery 1.8
- As of jQuery 1.8 `andSelf` was deprecated in favour of `andBack`.
  `andBack` was not available in jQuery <1.8, and I don't want to make
  1.8 a requirement yet, so a small workaround requiring two unbind
  calls is used to avoid calling `andSelf` or `andBack`.
2013-02-07 08:29:51 +00:00
Allan Jardine
da2a834177 Dev: Tidying up documentation comments for main DataTables file 2013-02-05 09:36:58 +00:00
Allan Jardine
d740f0484d Update - docs: Add examples for the xhr event and clarify when it fires
- `xhr` event fires before DataTables processes the returned data, so
  you can listen for `xhr` and use it to manipulate the returned data.
2013-02-05 09:31:48 +00:00
Allan Jardine
f35801b111 Fix: jQuery migrate warning on display length initial setting
- jQuery migrate gives a warning about the use of `attr` rather than
  `prop`. However, we should really just be using `val` here - much
  easier.

- Thread: 13931
2013-02-05 06:49:59 +00:00
Allan Jardine
8045c7471e Dev: Committing recent changes into built script 2013-02-04 19:57:59 +00:00
Allan Jardine
1b6ffeaf78 Updated: data and render can now have periods escaped from dotted
object notation.

- Previously if you had an object key that contained a period, it
  wouldn't work with `data` or `render` (or rather it would need a
  function call to do it manually), since a split was being done on the
  periods to reconstruct the Javascript object property chain. Now it is
  possible to escape a period, allowing it to be included in the
  property name read / set.

- Example:

$('#example').dataTable( {
	columns: [
		{ data: 'a' },
		{ data: 'b\\.c' }
	],
	data: [
		{ 'a': 1, 'b.c': 2 },
		{ 'a': 3, 'b.c': 4 },
		{ 'a': 5, 'b.c': 6 },
		{ 'a': 7, 'b.c': 8 }
	]
} );
2013-02-04 19:44:41 +00:00
Allan Jardine
b2de50229e New: data and render options for columns support function notation
- As part of completing the planning development for reading data, I've
  added support for calling functions from the string defined in `data`
  and `render` column options. So you can now do something like:
  `render: 'name()'` rather than needing to use an anon function and
  calling name() in that. This is useful for cases where you want to
  give DataTables an array of Javascript instances, rather than objects
  or arrays (see example below). It also fully supports the continuation
  of the dotted notation DataTables supports, so you could use
  `name().first` if `name()` returns an object. Again to make it easier
  than needed to define a function.

- Documentation for `data` and `render` updated to reflect this
  abilities

- Unit tests for this still to come

- There is one backwards incompatiblity that should be noted - although
  I think this is a real edge case and I just can't see it being an
  issue. If before, you had `data:null` without `render` or
  `defaultContent` specified, DataTables would have output an empty
  cell. Now it will output the original data source object. Can't see
  this being an issue since, why would you have a column empty cells? If
  this is an issue, then you simply need to add `defaultContent:''` now.

- Example use case, using Javascript instances:

$(document).ready(function() {
  var z = function (i) {
    this.a = function (set) {
      if ( set ) {
        return this;
      }
      return i+'-0';
    };
    this.b = function (set) {
      if ( set ) {
        return this;
      }
      return i+'-1';
    };
    this.c = function (set) {
      if ( set ) {
        return this;
      }
      return i+'-2';
    };
    this.d = function (set) {
      if ( set ) {
        return this;
      }
      return i+'-3';
    };
    this.e = function (set) {
      if ( set ) {
        return this;
      }
      return {
        q: i+'-4q',
        w: i+'-4w'
      };
    };
  };

  window.dataset = [
    new z(0),
    new z(1),
    new z(2),
    new z(3),
    new z(4),
    new z(5)
  ];

  $('#example').dataTable( {
    columns: [
      { data: null, /*render: 'a()'*/ },
      { data: 'b()' },
      { data: 'c' },
      { data: 'd()' },
      { data: 'e().q' }
    ],
    data: dataset
  } );
} );
2013-02-04 11:05:40 +00:00
Allan Jardine
b4aee323bd Fix #136 - Allow bDestroy / bRetrieve to have defaults set
- Typically I think setting bDestroy or bRetrieve as default true is a
  bad idea as it could lead to more processing of tables than is needed
  by mistake, but if set the defaults should be acted upon.

- These are slightly different to the other defaults since the settings
  object hasn't been expanded by the point they are checked, so need to
  manually check the values.
2013-02-02 12:09:15 +00:00
Allan Jardine
10a0d7bd04 Dev: Update comments for browser feature detection 2013-02-01 10:29:03 +00:00
Allan Jardine
415ce622c3 New: Scrolling support for rtl language layout
- When scrolling is enabled, the scrollbar can be placed on the right or
  the left of the scrolling container by the browser for rtl layout (of
  the current browsers, only Safari appears to place it on the right) -
  when placed on the left the padding adjustment that DataTables makes
  for the scrollbar area was added to the wrong side.

- To cope with this, the browser compat method (moved to the compat
  file) will check for the position of the scrollbar and set a flag so
  the scroll draw can adjust the position as needed.
2013-02-01 10:05:45 +00:00
Allan Jardine
177400121e Fix: Documentation typo or sWidth 2013-02-01 10:04:20 +00:00
Allan Jardine
0e8e0d6793 Update: Updating to jQuery 1.9 2013-02-01 10:02:57 +00:00
Allan Jardine
076744a84c Merge branch 'master' of github.com:DataTables/DataTables 2012-12-21 09:36:10 +00:00
DukeAstar
d9bb6b63cd Fix backward compatibility with mDataProp = null 2012-12-07 22:32:41 +01:00
Tiax
a528bbb6b6 Applying proper CSS classes for sorting to columns
As discussed on the forums here: http://datatables.net/forums/discussion/12736/setting-sortable-with-aocolumndefs-glitched
2012-11-23 10:49:26 +01:00
Allan Jardine
36fc3cc92e Update: If aLengthMenu is given, but iDisplayLength is not, DataTables used to default to using the built in iDisplayLength option. However, this lead to a bit of confusion as to why the first value from aLengthMenu was not used (issue #61 and numerous forum posts). This commit changes that behaviour - the first value from aLengthMenu is used, if iDisplayLength is not given as well. 2012-11-02 09:28:06 +00:00
Allan Jardine
823e64cccb Dev: A bit of love for hte type detection functions. Tidy them up and improve the comments. 2012-11-02 08:43:37 +00:00
Allan Jardine
33d3667bbe Update: Much smaller numeric type detection method, based on isNumeric in jQuery. Also a whole lot faster. 2012-11-02 08:33:07 +00:00
Allan Jardine
a073515b20 Update: fnUpdate is now inline with the changes to how data can be added to the table. Rather than taking a copy of the data source, it will simply assign the data given to the row (if it is given for the row) and apply it. Documentation comments update as well. 2012-11-01 21:56:02 +00:00
Allan Jardine
065c2cc66b Fix: Filtering wasn't correctly applying the type adjustments needed for the global filter. For example this meant that html was not stripped from 'html' type columns, resulting in filtering being done on html tags/attributes as well as the content. 2012-11-01 21:45:48 +00:00
Allan Jardine
b56f3619cb Dev: Remove padding on code when in the syntax highlighter 2012-11-01 21:45:26 +00:00
Allan Jardine
46d483d055 Tests: With the change for the state saving into localStorage we need to update the state destroy in the unit tests 2012-10-31 18:12:22 +00:00
Allan Jardine
94f06473c6 New: DataTables now uses HTML5 localStorage by default for state saving. This has a number of advantages over cookies, the first of which is that we are no longer limited to 4KiB in size. It also makes HTTP requests faster since they aren't included in the HTTP transport. Better yet, the removal of the cookie code reduces the DataTables minified size by 1.5K (1573 bytes). It must be noted that this does mean that IE6/7 don't, by default, work with state saving in DataTables. If support for those browsers is required, then fnStateSaveCallback and fnStateLoadCallback must be used by the developer to define their own state saving methods.
Removed: fnCookieCallback (cookieCallback) - This is now irrelevant since DataTables does not state save in cookies by default.

Removed: sCookiePrefix (cookiePrefix) - This is now irrelevant since DataTables does not state save in cookies by default.

Depreciated: iCookieDuration (cookieDuration) - Since DataTables does not use cookies for state saving by default the name of this parameter is now incorrect. The new parameter `stateDuration` should be used instead, although the old parameter is still supported. It will be removed in the next major version of DataTables.
2012-10-31 18:09:41 +00:00
Allan Jardine
c883cdac54 Dev: Fix issue with the moved oInit defaults copy - couldn't get a reference to an exisiting DataTable 2012-10-31 15:42:09 +00:00
Allan Jardine
0ff0858734 Dev: Fix logic check for passing data to the updated _fnCreateTr method 2012-10-31 15:39:10 +00:00
Allan Jardine
5209e2f058 Dev: Removed the _fnGatherData method, replacing it with _fnAddTr and slightly updated _fnAddData / _fnCreateTr. This means that the new API add add existing TR element if needed, but more importantly it reduces code duplication and makes the code size smaller (almost 1K - 967 bytes exactly, minified). Must confess I was really hoping it would be more, but every little helps... 2012-10-31 14:56:34 +00:00
Allan Jardine
3ac3cedf53 Fix: When sorting numerically, '-' and '' should be treated as -Infinity rather than as 0, since negative numbers could also be used int he column and this would split the numbers. 2012-10-30 21:05:15 +00:00
Allan Jardine
ec0556b4f6 Updated: Changing the formatting that DataTables uses for the version numbers to be compatible with semver (http://semver.org/). The impact is minimal (unless you are parsing the version for the final part in dev builds). The change is to use a dash ('-') at the end of the version string for a non-release build, rather than a dot. 2012-10-28 16:39:35 +00:00
Allan Jardine
eafd70f53a Dev fix: When updating the parameters for lack of hungraian notation, I renamed 'iDeferLoading' as 'deferLoading' which broke server-side processing... 2012-10-28 16:34:11 +00:00
Allan Jardine
8eb8c90627 Dev - Build latest changes 2012-10-26 08:04:14 +01:00
Allan Jardine
e89958cb45 Fix docs: Example for mRender has a syntax error 2012-10-26 08:02:59 +01:00
Allan Jardine
cab0c534f1 Fix - core: Stripe removal was broken - it was stripping the classes from only the first row rows, rather than all of them, which was wrong. This was unfortunatly introduced in 1.9.4 and there weren't any unit tests to catch it. There are now, and I've rewritten the code that wil remove existing stripe classes. Its now much smaller and should be a little faster. Now it only checks the first row to see if it has any exisiting stripe classes, which is good enough. The smallest this could could be would be a simple removeClass, but that may result in significant overhead which really isn't needed in cases where there are no exisiting stripe classes. 2012-10-19 15:31:35 +01:00
Allan Jardine
8e1068e603 Dev fix: Fix issue highlighted by JSHint - The DataTable object is addressed in the private methods so it needs to be defined before them, but the contracturo needs to come after the priavte methods! 2012-10-07 18:13:16 +01:00
Allan Jardine
0e3a60b52f Dev fix: Variable name oSettings was incorrect 2012-10-07 18:11:54 +01:00
Allan Jardine
f7dddabfa3 Fix: Trailing comma 2012-10-07 18:11:41 +01:00
Allan Jardine
de935de4c6 Merge branch 'master' of github.com:DataTables/DataTables 2012-10-07 18:08:56 +01:00
Allan Jardine
ab454c1c33 Fix: In _fnExtend there was a bug where a variable referenced a 'locally global' (for lack of a better term) variable rather than the in function variable that it should be have. Got away with this since _fnExtend is only used for one thing at the moment, but it was wrong. Now fixed.
Update - Performance / Memory: The functions that DataTables uses are not instance based, they are locally scoped, but they were included in the DataTable constructore, which meant that every time you create a new 'instance' of DataTables ($().dataTable()) it would create these functions in that scope again and again. That's completely pointless since we only need them once, so moving them outside the constructor helps both performance and memory (not huge, but very little helps!).
2012-10-07 18:02:38 +01:00
Tim Tucker
2b35b262cb Update media/src/api/api.static.js
Variable initialization was wrong in the prior pull (should have been iThat, not sThat)
2012-10-07 09:11:10 -03:00
Allan Jardine
f420f1462b Merge pull request #117 from timtucker/patch-29
Dev: Modify how DataTables builds the filtering regular expressions to simplify.
2012-10-07 04:31:06 -07:00
Allan Jardine
ec10497217 Dev: Update generated file from the marges made recently 2012-10-07 12:23:24 +01:00
Allan Jardine
7a388a0a76 Merge branch 'master' of github.com:DataTables/DataTables 2012-10-07 12:23:07 +01:00
Allan Jardine
09a9976907 Dev: Trivial code styling change 2012-10-07 12:22:18 +01:00
Allan Jardine
7bcd2955ff Merge pull request #116 from timtucker/patch-28
Dev: Remove unused variable in _fnDraw
2012-10-07 04:15:17 -07:00
Allan Jardine
76507795ed Merge pull request #109 from timtucker/patch-22
Update media/src/core/core.ajax.js
2012-10-07 04:14:12 -07:00