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

825 Commits

Author SHA1 Message Date
Allan Jardine
fcc7d4a78d Internal - refactor of table information control 2013-04-22 18:56:20 +01:00
Allan Jardine
be611d0db8 Update: Header for the minified file has been reduced to save a bit of space 2013-04-22 18:55:50 +01:00
Allan Jardine
cdd82a9d0e Internal - refactor processing display
- Simple refactor into the more mordern 'style', only saves about 100
  bytes, but the code looks much cleaner.
2013-04-22 09:09:14 +01:00
Allan Jardine
414abff7e6 Dev - fix attributes for empty row weren't being applied 2013-04-22 09:08:49 +01:00
Allan Jardine
73e265218e Internal - Small refector of fnDraw
- Use variable aliases to allow better compression
- Replace body append code with jQuery code. Much simpiler, and only
  a very small performance hit (around 1mS for a draw of 100 records).
2013-04-22 08:58:28 +01:00
Allan Jardine
63d9f3f21e Internal - Refactor
- Remove the settings._iDisplayEnd parameter finally, using only
  fnDisplayEnd() is needed, and the end point is calculated on-the-fly
  when needed (which is not often and it is not expensive). This also
  means that the internal method `_fnCalculateEnd` can be dropped
  completely.

- Refactoring the empty cell in _fnDraw
2013-04-21 20:02:23 +01:00
Allan Jardine
09761bfdef New - Rows and Columns selectors
- columns() and rows() introduced with their selector components. They
  don't have any additional funtionality at this time other than just
  being able to selector rows and columns (returning arrays of indexes),
  but the principle is now in place, and the additional functions can be
  fleshed out.

- Moving to use a work in process branch, as some aspects of DataTables
  may break as this work continues, and certainly the files etc are all
  in flux
2013-04-21 16:37:38 +01:00
Allan Jardine
a077d24e6a Internal - Small change to the new order() method to remove redundant code 2013-04-20 12:04:18 +01:00
Allan Jardine
2e278b0285 New: Ordering functions for the new API:
- order() and order.listener() added (to replace fnSort and
  fnSortListener) from the old API.

- Note that the name `order` is selected to not conflict with the `sort`
  method of the API object, which can be used to order the sort data
  held in the collection.

- The `sort()` method is expanded over the abilities of fnSort to allow
  multiple different forms of input (column + direction, 1D array, list
  of 1D arrays or a 2D array).
2013-04-20 12:00:16 +01:00
Allan Jardine
aa76a6baf5 New: Add ability to do a static redraw to the new API
- draw() and ajax.reload() can now have `false` passed as their first
  (and currently only) parameter, which instructs DataTables to do a
  'static' redraw (i.e. not to reset the pagination).
2013-04-20 11:12:08 +01:00
Allan Jardine
edfbf7491d Internal - altering how a draw is called
- Previously the master sort and filter functions would perform a draw,
  but this was a bit redundant, complex and didn't allow multiple
  changes to be queued up before a new draw was performed. The new API
  will allow this ability, so we need to allow it in the core as well.
  You can now do a sort, and it will be performed internally, but not
  actually drawn until the redraw function is called. This makes a full
  redraw much simpiler, and has the benefit that a standing redraw is
  now relatively trivial since it is all performed in a single place.
2013-04-20 10:18:52 +01:00
Allan Jardine
e014d9272f New: ajax API methods:
- Introducing several methods which will control the ajax aspects of
  DataTables through the API:

  - ajax.json() - get the last JSON returned from the server
  - ajax.reload() - reload from JSON source
  - ajax.url( [url] ) - get / set the Ajax URL
  - ajax.url( url ).load() - load data from new URL after a set

- Note that this effectively replaces the old fnReloadAjax plug-in which
  was quite popular.

- Not yet fully tested - further work required.
2013-04-20 09:10:46 +01:00
Allan Jardine
15588d9e41 New - api methods: page(), page.info(), page.len(), draw()
- Paging control methods for the new API:
  - page() / page(n) - Get / set the current page
  - page.info() - Get information about the table's paging state
  - page.len() / page.len(n) - Get / set the page length

- Rewrite of core.page.js and core.length.js to be more space efficient.
  The functionality is identical to before, but now compresses much
  better (796 byte saving). The new paging API methods add only 614
  bytes (compressed), so overall a saving of 182 bytes, with the new
  functionality added by the new API.

- Start of draw methods for new API:
  - draw() - Draw the table. Need this to test the new paging methods
    since page() etc do not do a redraw themselves, you must call draw()
    when you are ready for the table to be redrawn now.
2013-04-18 07:49:38 +01:00
Allan Jardine
fa7122392d New: tables() and tables().nodes() methods for the new API:
- tables() is a table selector and iterator that most other API methods
  will likely use.

- tables().nodes() gets the selected HTML table nodes.

- Documentation of these functions is rather incomplete. Not yet sure
  how to fully document them. Currently thinking of having seperate
  documentation, a bit like jQuery, which can be a lot more involved,
  rather than building it fromt he doc comments which might get rather
  long (they already are!).
2013-04-17 14:35:15 +01:00
Allan Jardine
e9176bee48 New: First commit for the new Api.
- This commit introduces the new Api core, a 'class' which is a data
  helper and DataTable control interface. Methods of this class are
  designed to be chainable (although it is not manditory - some can
  return boolean values if needed).

- The core data helper functions are present in this comment, although
  not yet fully documented. That will come as the Api stablises and I'm
  happy with the structure.

- There are no table control methods yet - coming soon.
2013-04-16 16:38:53 +01:00
Allan Jardine
b1d88c1c91 Performance: Read the style.width property for the restore width and
apply that.

- This is much faster than the previous method of using $(this).width()
  since there is no longer an invalidation and getComputedStyle
  calculation. It just uses the value that is available in style.width,
  which might very well be empty (if the style attribute is used with a
  width property defined is it not empty).

- This also improves accuracy since it is the original that is restored,
  and not the calculated size.

- See http://datatables.net/forums/discussion/14811 for the discussion
  for this change.

- Thanks to `krzycho` for the discussion and suggestions.
2013-04-06 09:44:52 +01:00
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