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

809 Commits

Author SHA1 Message Date
Allan Jardine
ad0e08585f Performance: Width of scrollbars isn't going to change on a single page
between table's being reinitialised, so calculating the scrollbar width
every time is a real hit on performance since it needs to manipulate the
DOM. This change ensures that the calculation is performed only once.
2013-04-06 09:36:44 +01:00
Allan Jardine
182998a7c5 Fix: Remove pointer cursor from cells which cannot be sorted - 14826 2013-03-29 07:27:47 +00:00
Allan Jardine
a0ee82fe4b New: Foundation styling example.
- Likely this willl be moved into a 'themes' directroy along with jQuery
  UI and Bootstrap in future, but stashing it here for now.
2013-03-27 09:28:49 +00:00
Allan Jardine
5a0c1f5ac6 Fix #168 - fnInitComplete should give json as second parameter as well
- When server-side processing is enabled, fnInitComplete will now be
  passed a second parameter, the json returned from the server for that
  first draw, matching the Ajax data source with client-side processing
  option.
2013-03-27 09:25:55 +00:00
Allan Jardine
baa16632ec New - licensing: DataTables is now available under the MIT license
- Full license available here: http://datatables.net/license_mit

- Note that this effectively makes the BSD and GPLv2 licenses that
  DataTables is also available under redundant since the MIT is the most
  relaxed of these licenses. At some point in the not too distant
  future, it would make sense to remove these two licenses and have
  DataTables available under only the MIT license.
2013-03-15 09:56:27 +00:00
Allan Jardine
65b6e2f901 Merge branch 'master' of github.com:DataTables/DataTables 2013-03-11 16:33:32 +00:00
Allan Jardine
f0694a8fbb Dev: First commit of xml for examples build script 2013-03-11 16:32:28 +00:00
Allan Jardine
8d9e620ef2 Merge pull request #160 from zeitiger/master
Refactor filter search from input[text] to input[search]
2013-03-04 02:42:57 -08:00
David Steinkopff
5abeb777b7 Merge branch 'master' of https://github.com/zeitiger/DataTables 2013-03-04 08:43:49 +01:00
David Steinkopff
c2dd657fa8 remove hacking 2013-03-04 08:43:11 +01:00
David Steinkopff
00568d0724 Merge branch 'master' of https://github.com/zeitiger/DataTables 2013-03-04 08:40:53 +01:00
David Steinkopff
8efdd92a46 Merge branch 'master' of https://github.com/zeitiger/DataTables
Add requested changes
2013-03-04 08:38:31 +01:00
Allan Jardine
b87187fc5b Fix #162 - Flexible width is width="100%" is applied as attribute to the HTML table
- Attach an event handler to the window to resize the table. Note that
  this isn't debounced - possibly it should be in future(?), but don't
  want to add the additional code required if it isn't required. It
  seems to function perfectly well for me!

- Unbind needs to unbind by the instance unique reference since there
  might be multiple tables listening for the event.
2013-03-03 12:03:44 +00:00
Allan Jardine
25eaa86477 Dev fix: Typo in the name of _hungarianMap private parameter 2013-03-03 08:36:58 +00:00
Allan Jardine
2bd643468b New: Extend render option to use objects allowing different data to be
used for the different data types very easily.

- Until now, if you want to use different data for the different data
  types (I've called these orthogonal data in relations to DataTables)
  you had to specify a function. That's fine, but it seems a rather
  clumsy way of just pulling different data out of a source object based
  on the type. This method allows the data types to be very easily
  defined with an object, allowing the same rules as `render` normally
  does (dotted object notation, array notation etc).

- For example:

    $(document).ready(function() {
    	$('#example').dataTable( {
    		columns: [
    			{ data: null, render: {
    				_: 'a',
    				sort: 'c',
    				type: 'c',
    				filter: 'd'
    			} },
    			{ data: 'b' }
    		],
    		data: [
    			{ 'a': 1, 'b': 2, 'c': 4, 'd': '1' },
    			{ 'a': 3, 'b': 4, 'c': 3, 'd': '3' },
    			{ 'a': 5, 'b': 6, 'c': 2, 'd': '5' },
    			{ 'a': 7, 'b': 8, 'c': 1, 'd': 'allan' }
    		]
    	} );
    } );
2013-03-02 18:53:27 +00:00
Allan Jardine
079a1f2e1d Fix: remove tabindex from clone header nodes
- Tabbing through a scrolling table the tabindex on the cloned header in
  the body part of hte table meant that the browser would focus on those
  elements. Fix is to remove the tab index from the clone nodes.
2013-03-01 17:30:40 +00:00
Allan Jardine
e00037a1af Fix #161: DOM sorting plug-ins updated
- Cope with the change in jQuery 1.9 for element ordering. From the
  DataTables thread on this topic ( 14316 ):

So a bit of further investigation into this - I've used these two test
caseS:

No DataTables: http://live.datatables.net/uwidel/edit#source
DataTables: http://live.datatables.net/ivojev/4/edit

The new DataTables version shows that jQuery 1.9 is now always trying to
order the nodes by document order, not but the order that they are found
in the source array. Additionally removed nodes are appended to the
results, themselves in reserve order, but that's just the way the Sizzle
node ordering works when items are not in the document (try sorting
numbers and you get the same result).

Given the suggestion in the release notes that the move is to have nodes
always treated in document order, I don't think this is a bug, so not
filing one. It is a bit frustrating that the nodes are iterated in a
different order from the source array, but it is expected from their
documentation and comments. So this is simply something we'll need to
work around.

To that end, I've updated the examples and taken the unusual step of
updating the examples on this site outside the normal release cycle. The
examples in the 1.9.4 current release of DataTables can't change of
course, but the updated examples will be in 1.10 when it is released.
2013-02-28 18:55:31 +00:00
David Steinkopff
b0a25ebfe2 Merge branch 'master' of https://github.com/zeitiger/DataTables 2013-02-28 10:27:15 +01:00
David Steinkopff
9b003e6690 replace input[text] with HTML5 input[search] 2013-02-28 10:26:45 +01:00
David Steinkopff
4577a52056 replace input[text] with HTML5 input[search] 2013-02-28 09:41:49 +01:00
Allan Jardine
3e1a41dccd Merge branch 'master' of github.com:DataTables/DataTables 2013-02-26 21:33:52 +00:00
Allan Jardine
1bb4fc6896 Dev fix: Typo from a67ff2f 2013-02-26 21:33:00 +00:00
Allan Jardine
25ded41662 Merge pull request #155 from benn0r/master
Added Composer Support
2013-02-20 08:20:47 -08:00
benn0r
c0a273b007 Added composer support 2013-02-20 11:17:20 +01:00
Allan Jardine
a67ff2fadb Dev: Trivial tidy up of _fnConvertToWidth
- Just 43 bytes saved, but tidier code and smaller size...
2013-02-18 08:47:47 +00:00
Allan Jardine
7c53a1824c Dev: Tidying up scrollbar width calcuation function
- Using jQuery we can make the code a bit smaller. Not much, just a 97
  byte saving, but every little helps, as they say....
2013-02-18 08:42:32 +00:00
Allan Jardine
4c4bfb04b8 Dev: Remove trailing white space
- JSHint flagging warnings on trailing whitespace, so tidying up. Boring
  commit, but these things must be done!
2013-02-17 17:59:27 +00:00
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
83b9624273 Examples: Updating examples for the new ajax property
- Note that this update is not complete, just the initialisation is
  done. The examples will shortly be rewritten to be more modular when
  this will be completed (i.e. the code shown on the page will be
  updated)
2013-02-10 12:26:42 +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
00e6651c4e Dev: Remove debug from example 2013-02-04 19:57:00 +00:00
Allan Jardine
2645463304 Example: Removed localStorage example
- DataTables now uses localStorage by default
2013-02-04 19:48:39 +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
8dcd96f300 Update - Examples: Column filtering now uses placeholder attribute
- Rather than using Javascript to show a placeholder, use the HTML5
  `placeholder` attribute. That is what it is there for and is supported
  by all current shipping browsers (IE9- do not support it, but will not
  break)
2013-02-02 15:46:38 +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
6d140835a9 Update: Examples syntax highlighter needs to use on rather than live 2013-02-01 10:03:26 +00:00
Allan Jardine
0e8e0d6793 Update: Updating to jQuery 1.9 2013-02-01 10:02:57 +00:00