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

777 Commits

Author SHA1 Message Date
Allan Jardine
c6d8545319 Api: ajax.url().load() should also have a resetPaging option
- ajax.reload() and ajax.url().load() now have the same options
2013-12-11 10:57:25 +00:00
Allan Jardine
1daaf4e473 Dev fix: Show "Loading..." message when using ajax option not just
sAjaxSource
2013-12-11 09:32:28 +00:00
Allan Jardine
c20681668a New: no-footer class automatically added to the table when no tfoot
- It appears that ti is impossible to know in CSS if a table doesn't
  have a tfoot element reliably and cross browser, so I've added a class
  which is added to the table automatically if the table has no footer
  or the fotoer is empty to complete the styling of the table.

- Fixed error when there are no cells in an empty TR row in the footer.
2013-12-10 17:54:53 +00:00
Allan Jardine
7a171b14c2 Dev fix: row().child() checks for undefined now since an empty string
would be a valid input for a details row. Not a useful one, but
none-the-less a valid on.
2013-12-10 17:31:46 +00:00
Allan Jardine
c85bcab903 New: Add postfix fixed ordering option
- With the change to camelCase, it is easier to extend the usageof
  optiosn now, and in this case I've allowed the `orderFixed` (formally
  `aaSortingFixed` parameter to be passed in as an object as well as an
  array. As an object the `pre` and `post` parameters are used to
  specify prefix and / or postfix ordering. Useful for gouping.
2013-12-10 17:31:35 +00:00
Allan Jardine
dd1e7600ac Dev fix: Destroy wasn't working when using deferred rendering
- The _pluck() function that was being used to get the tr elements
  didn't remove nulls, while jQuery doesn't like removing a class from!

- Thanks to `RagingTroll` in the forums for spotting this:
  http://datatables.net/forums/discussion/18651
2013-12-09 13:05:30 +00:00
Allan Jardine
18c53eaed5 Dev fix: When using _fnExtend to extend with an object, need to check if
the property being expanded is an object or not. If not, then set it to
be an empty object which will be extended. Only really effected the
`ajax` property
2013-12-09 12:52:06 +00:00
Allan Jardine
7e67778c51 Dev: Change to how the init object is copied for multiple tables
Based on the discussion in the forms (
http://datatables.net/forums/discussion/18456 ) the fix from 8935b8a
wasn't good enough. What was happening was that the _save_data function
was doing a deep copy of all arrays (minus the data array) so the
default sort was stil applied.

The fix is to reinstate the _fnExtend function which does a jQuery like
deep extend on objects and a shallow extend on arrays. That is extended
slightly to allow array references to be broken on initialisation, to
resolve the issue 8935b8a attempted to (sorting array would be used for
two tables for example), by an optional parameter. This should resolve
the issue correctly this time!
2013-12-05 12:01:44 +00:00
Allan Jardine
8f356ab917 Dev fix: When no ordering was aplied to the table, the next order would
throw an error
2013-12-05 12:01:33 +00:00
Allan Jardine
703ee53c47 Dev fix: API - destroy() was giving a JS error on scrolling tables
- http://datatables.net/forums/discussion/18584
2013-12-04 17:10:59 +00:00
Allan Jardine
d0a0ef8ad1 Dev fix: $.fn.dataTable and $.fn.DataTable should both have the same properties available
- This fixes DataTables/DataTables issue #241.

- Most of the properties attached are objects, so we want the references
  to them, rather than a copy, so a simple assignment is all that is
  needed. Strings etc will continue to work as well.
2013-11-29 11:59:43 +00:00
Allan Jardine
d4a1028a1d Dev fix - Full backwards compatiblity with fnServerParams with array
syntax paraneter names

- Data added using fnServerParams with array syntax had different
  behaviour in 1.10 from 1.9. In 1.9 jQuery would create an array for
  us, but in 1.10 before we create an object first, we need to create
  that array ourselves. So the following code had different behaviour:

		"sAjaxSource": "data/arrays.txt",
		"fnServerParams": function ( d ) {
			d.push(
				{name: 'somekey[]', value: 'somevalue1'},
				{name: 'somekey[]', value: 'somevalue2'}
			);
		}

In 1.10 it would have sent `somekey[] = somevalue2` but 1.9 would have
sent both as part of an array.

To maintain full compatiblity with 1.9 we need to convert this syntax to
an array - this commit does that.

I was concerned about using parameters in the brackets, but jQuery only
searches for `[]` when performing this conversion. We could use $.param
and then decode the created query string, which would be absolutely 100%
comaptible, but would involve additional code and I think this method
provides that 100% compatiblity from reading the jQuery code), and its
shorter.
2013-11-29 11:36:03 +00:00
Allan Jardine
4549646891 Dev fix: Sort indicator items weren't being redrawn
- Confusion aorund the `order` and `sort` events which resulted in the
  sort icons not being updated
2013-11-21 13:46:17 +00:00
Allan Jardine
7a32f2db93 API: Column selector - add support for visible indexes counting from the right
- The ability to use negative numbers as a column selector for the
  column data index was added recently, but that didn't include the
  ability to work with negative numbers with the :visible pesudo
  selector. This commit adds that ability so you can do:
  `table.column("-1:visible")` to always get the right most visible
  column
2013-11-19 13:55:08 +00:00
Allan Jardine
32e27fcc2f Api: Column selector - jQuery selector as a string, an name selector
with :name postfix.

- Previously you could use a jQuery selector for columns by using the
  :jq postfix, and names were matched otherwise. This is reversed now
  for consistency with the rows and cells selectors which treat strings
  as jQuery selectors without the :jq postfix.
2013-11-19 13:54:53 +00:00
Allan Jardine
e82068e7b3 Dev fix - incorrect fix for the API extend method before. Was looking
its own reference
2013-11-19 13:54:41 +00:00
Allan Jardine
6740193eed Dev fix: The API chaining was a little broken if the inner function
returned undefined, null etc.

- The base issue was in the instanceof check which has a priority error,
  it was:
    ! obj instanceof _Api
  which is the same as:
   (! obj) instanceof _Api
  which is rubbish.

  We want:
    ! (obj instanceof _Api)
  but there is of course a wrapper function, so that needs ot be taken
  into account as well. The new logic does just that.
2013-11-19 13:54:14 +00:00
Allan Jardine
8919616833 Docs: row() and rows() API documentation 2013-11-19 13:54:02 +00:00
Allan Jardine
8dcdb94b15 API - invalidate() methods - add an "auto" option that can be passed
rather than jsut an empty string as auto
2013-11-19 13:53:48 +00:00
Allan Jardine
48fd750bd8 Fix: Initialisating multiple DataTables with a single call was broken
- Because of the manipulation of the initalisation object initialisation
  of multiple tables with a single jQuery call (i.e.
  `$('.dataTable').dataTable();`) was broken since the second table
  would see the modified init object. Need to take a coopy of the object
  before entering that state.

- This could probably do with a bit of a clean up sometime...
2013-11-19 13:53:36 +00:00
Allan Jardine
8a5712b7e9 Update - init options: Rename displayLength to pageLength for consistency
- The displayLength option is poorly named, particularly with the new
  API refering to it as the page length (page.len()) so, using the new
  translation option to allow backwards compatiblity while using new
  parameter names, I've updated this parameter's name and its
  documentation.
2013-11-18 13:43:58 +00:00
Allan Jardine
7119dfa50c API: Selectors - 'filter' selector modifier renamed to be 'search'
- Renaming in keeping with the new terminology
- Updating example which uses it (main documentation still to be
  written)
- Backwards compatible with a bit of logic to check if the old version
  is being passed in
2013-11-18 13:43:46 +00:00
Allan Jardine
d47da33826 Old API: Mark $ method as deprecated 2013-11-18 13:43:34 +00:00
Allan Jardine
a423c0f457 API - dev: Remove the plugin() methods from the new API
- Decided that it would be better to provide the new API by having
  plug-ins extend it directly, rather than providing their own API.
  Using the plugin() method it was possible to get a plug-in insta,ce
  for example TableTools, but the way it should work is that TableTools
  would provide a tabletools() API method, registering it as an
  extension to the DataTables API objects. Further more, TableTools
  should provide methods such as row().select() etc, extending the
  current API rather than doing its own thing which the plugin() methods
  prompted.

- No backwards compatiblity issues here as the plugin() code hasn't
  shipped as a release.
2013-11-18 11:46:39 +00:00
Allan Jardine
635a027057 Dev: Remove the static construct method that had been added as part of 1.10
- I added a static DataTable.on() method previously in the 1.10
  development for a single event called `construct` which would tell us
  when a table was constructed. But I've realise that since the events
  that DataTables' triggers bubble up through the document, that effect
  can already be achieved:

- Use:
  - $(document).on( 'init.dt', function ( e, settings ) { } );

- Rather than:
  - $.fn.dataTable.on( 'construct', function ( settings ) { } );

- No backwards compatiblity issues as the DataTable.on code was never
  shipped, its dev code only
2013-11-18 11:46:15 +00:00
Allan Jardine
0f18491cf1 New: Warning on generic Ajax error (404 etc)
- Previously DataTables would only show an error message if there was a
  JSON parsing error. However, if there was any other kind of error,
  such as a 404, it would just silently swallow the error. THink its
  best to show an error and a tech note.
2013-11-18 11:46:04 +00:00
Allan Jardine
6dcc69ee54 New: DataTables events are now all bound to the .dt namespace
- This is a breaking backwards incompatible change - please be aware of
  this!

- DataTables fires custom events such as `draw` etc, but these events
  were in no way identifyable as eminating from DataTables rather than
  some other component, which can cause confusion and difficulty
  resolving bugs.

- As such, all DataTables events are now fired with the `dt` namespace -
  this means if you are currently using events, you must update your
  code to also use the .dt namespace. If you are already using
  namespaces, that's great, you can continue to do so as jQuery allows
  multiple namespaces, but you must still use the .dt namespace.

- This is a breaking change because the old behaviour was incorrect -
  i.e. this was a bug to be fixed, hence why we haven't gone through a
  deprecation cycle. The old events weren't well documented (only in the
  JSDoc generated docs and a few of my forum posts), whereas in 1.10
  they will form a key part of the documentation. As such, now is the
  time to get this right. This will be documented clearly in the upgrade
  notes.

- Discussion on this topic here:
  https://github.com/DataTables/DataTables/issues/245
2013-11-18 11:45:41 +00:00
Allan Jardine
ed4afe6178 Api: Column selector - add the ability to select columns counting from
the right by passing in a negative number
2013-11-14 17:21:48 +00:00
Allan Jardine
48931bbb18 Api - columns: Corrections found durating documentation:
- columns().cache() should check for the parameter 'search' for naming
  consistency

- Plural error on column().nodes()

- Change column.index() fromIndex/toIndex to fromData/toData - its an
  index be it data or visible, so the old method was meaningless
2013-11-14 17:08:24 +00:00
Allan Jardine
debea960c6 Api fix - cache() method should look for 'search' as the passed in
parameter
2013-11-14 17:08:10 +00:00
Allan Jardine
5c9d54e6f5 Api: table().header() and table().footer() methods for naming consistency
- The columns() methods have header() and footer() children to get the
  header and footer cells for the columns. For naming consistency the
  table() methods should be named likewise
2013-11-14 17:07:57 +00:00
Allan Jardine
b956a69271 Fix - API: Errors in plurals and signular forms of method naming 2013-11-13 16:22:04 +00:00
Allan Jardine
7cf5f904d8 New: Api methods - to$, toJQuery and join
- to$ - Convert the result set to a jQuery object. Compliment to the
  toArray method. This is mainly useful when working with the node() and
  nodes() methods.

- toJQuery - Alias of to$

- join - Array join method
2013-11-13 16:21:52 +00:00
Allan Jardine
e1f0fd2dee Updated: Naming consistency for searching and ordering
- With the new API the filter() and sort() methods already have meaning
  (the array methods built into Javascript) so the methods for filtering
  and sorting in the API are called search() and order() respectively.
  However, the intialisation parameters and events in DataTables use a
  mix of filter, search, sort and order in their terminology so this
  commit harmonises on just search and order, updating where
  appropriate.

- There are a number of incompatible changes if you are already using
  the new options in 1.10, but no incompatible changes to the latest
  release (1.9.4). 1.10 changes:
    - Server-side processing, the new parameters sent have been updated
      to refelect the new terminology
    - The Ext object likewise has been updated

- Default with the old options and padding int he old options will still
  work as before, compatiblity functions have been added to provide
  mapping. If both are provided the new parameter value will take
  president.

- The change is primarily around `sort` since that was reasonably
  consistent in its terminology for the initlaisation parameters before.
2013-11-12 19:18:40 +00:00
Allan Jardine
c8d2ebedc1 Merge branch '1_10_wip' of github.com:DataTables/DataTablesSrc into 1_10_wip 2013-11-12 19:18:18 +00:00
Allan Jardine
8c2c65c9dd New: Cached footer cells can now have colspan properties, allowing
column index referencing of the cells.

- Previously a colspan in a footer cell would cause index misalignment -
  for example if you had a table of 6 columns with two in the footer
  (one colspan=5) the fotoer cells would be assigned to the first two
  columns in the table, breaking column index order. Now a cell can be
  used over multiple columns. This allows column().footer() to always
  reflect the cell that belongs to that column (possibly sharing it with
  other columns).

- Note that the footer will only use cells from the first row in the
  footer. If there is more than one row, use table().foot() to access
  the TFoot element and then manipulate it as needed.
2013-11-12 19:18:06 +00:00
Allan Jardine
ad973fec36 Fix - docs: Error in examples for xhr event 2013-11-12 19:17:54 +00:00
Allan Jardine
d389c6d348 Docs: Event docs in the new XML format for the web-site 2013-11-12 19:17:31 +00:00
Allan Jardine
a287b560b8 New: Add built-in support for percentage numbers 2013-11-12 19:17:18 +00:00
Allan Jardine
45f9be18ed Docs: Complete the XML docs for the top level DataTables options 2013-11-12 19:16:40 +00:00
Allan Jardine
87832058d4 Docs: More documentation of the options 2013-11-12 19:16:28 +00:00
Allan Jardine
90599e45a6 Docs: Further documentation of the options DataTables has available 2013-11-12 19:16:15 +00:00
Allan Jardine
fd550de897 Update file header to use minifier friendly copyright header
- JSDoc comments still exist, but the information is to some degree
  duplicated.

- Copyright header matches what is used in the minified script now
2013-10-19 19:01:34 +01:00
Allan Jardine
62aef83013 Examples - Add initialisation code, HTML and other information to
display

- In the examples we want to show the following information to help
  developers to get to grips with DataTables more readily:
    - Init javascript code
    - HTML used for the table
    - Additional CSS used
    - Ajax loaded data
    - List of the libraries files loaded in the example

- All but the last point is complete, a bit of styling and information
  text.
2013-10-16 12:03:14 +01:00
Allan Jardine
6c10109119 Dev: Update JShint file for JShint 2.1 and apply fixes from errirs it
spotted
2013-10-15 15:31:45 +01:00
Allan Jardine
c916bb05fe New: search() and column[s]().search() API methods now have a 'get'
option

- By passing in no parameters to the search API methods we can get the
  current search value - for example:
      $('#example').DataTable().search();

- This is to round of the API as the order() method already has a get
  option as to the paging information
2013-10-15 15:31:35 +01:00
Allan Jardine
ecd36146e9 Examples - update server-side processing examples for new data
New: Server-side processing scripts rewritten to use PDO and use a class
with static functions for code sharing between all examples.
2013-10-15 14:40:19 +01:00
Allan Jardine
c9c8e65708 Updated - server-side processing support for camelCase variables
- As part of the 1.10 move to camelCase the server-side processing
  return now accepts camelCase variables as well as the old 1.9
  hungarian notation.
2013-10-14 17:33:54 +01:00
Allan Jardine
a70f109ac4 Dev - code regoranisation for new methods
- Variables and functions which are to be private in DataTables, but
  available across all files have a single leading underscore.

- Variables and functions which are to be private in a single file have
  two underscores (but no self executing function to restrict scope as
  that will just take extra space).

- Externally exposed functions and JSHint globals list updated
2013-10-14 14:06:09 +01:00
Allan Jardine
fa5b99a586 Update exposed functions list 2013-10-14 14:06:00 +01:00
Allan Jardine
686b9c9b72 Size: Refactor _fnBrowserDetect slightly to reduce size a small amount 2013-10-11 17:31:33 +01:00
Allan Jardine
a9035942d0 New - API: plugin(), plugin.register() and plugin.deregister() methods
- When working with plug-ins such as TableTools, there is no clearly
  defined way at the moment to get at the plug-in instance, with each
  doing it its own way (TableTools as a static function, while Scroller
  attaches itself to the settings object and KeyTable is its own
  intialiser, amoung others...) so I'm introducing these methods to
  unify this.

- plugin() is used by DataTables users to get their plugin instance, for
  example `table.plugin('tabletools')` would get the TableTools
  instance allowing full access to its API.

- plugin.register() and plugin.deregister() are called by the plug-ins
  when they attach themselves to a DataTable. The 'extras' will all need
  to be updated to use this new method.
2013-10-11 17:19:10 +01:00
Allan Jardine
846c4d9c60 New - API: Static on() method, which listens for static events from DataTables
- Some plug-ins would benefit from be able to automatically initialise
  when a DataTables is constructed, to this end, a construct for static
  events is added here, with the static function $.fn.dataTable.on()
  listening for events. Currently only the `construct` method is
  available, although others could potentially be added in future if
  they are useful. As such, the code driving it is intentionally simple
  for this cas,e but the API abstract enough to allow future expansion.

- There is no `off()` method, as I'm not sure it would be that useful.
  Could be added in future if needed!
2013-10-11 16:09:30 +01:00
Allan Jardine
4e05760b20 New: Add callback function to the ajax.url().load() and ajax.reload()
methods
2013-10-11 16:09:19 +01:00
Allan Jardine
8f975060d8 New: Server-side processing parameters update
- The server-side processing parameters used by DataTables 1.9 are very
  ugly, and rather arkward to work with, so in keeping with the
  camcelCase approach of 1.10 and its general monderisation, when using
  the `ajax` option to set the ajax url for data, DataTables server-side
  processing will now use a much more modern method of telling the
  server what data is required - specifically using arrays and objects
  in neatly formatted data.

- The old 1.9 method is invoked if sAjaxSource is used to set the ajax
  url, or if $.fn.dataTable.ext.legacy.ajax is set to true. As such,
  this change should be fully backwards compatible since `ajax` is a new
  option in 1.10.

- This new ability adds 334 bytes to the min file, primarily, because
  the old method is retained (using just the new method would actually
  reduce the size slightly).
2013-10-11 15:39:54 +01:00
Allan Jardine
9d642814cc Size - refactor Ajax server-side processing parameter builder 2013-10-11 14:22:10 +01:00
Allan Jardine
3e0637f910 Dev: Fix type in last commit 2013-10-11 14:22:00 +01:00
Allan Jardine
c3a2ad6f40 ize - refactor _fnInitialise for size. Only about 60 bytes saved 2013-10-11 14:21:49 +01:00
Allan Jardine
5c0cdd86cd Size - refactor sizing functions to reduce file size and modernise code
- The _fnCalculateColumnWidths is probably the oldest function in
  DataTables which has mostly reamined as it was 5 years ago! However,
  its time to trim it down a bit and optimise now. This rewrite has all
  the same actions, but results in a minified file which is about 700
  bytes smaller than before.
2013-10-11 14:21:38 +01:00
Allan Jardine
920b7671fb Dev fix - Broke non-scrolling tables with the scrolling refactor 2013-10-11 09:48:22 +01:00
Allan Jardine
70a3f88d8d Dev - tidy up changes 2013-10-10 17:47:11 +01:00
Allan Jardine
b178ab69a2 Removed - bAutoCss and refactor scrolling functions for size
- The bAutoCss parameter is not one that I've ever actually seen used,
  so I've dropped it out here to reduce complexity. It was only useful
  for making the scrollbars always visible on the table, which can just
  as easily be done with `div.dataTables_scrollBody { overflow: scroll
  !important }` since that will take a heigher priority that the
  DataTables appled style.

- The moster _fnFeatureHtmlTable and _fnScrollDraw functions have been
  refactors, saving around 1.5K in size (in the minified file)
2013-10-10 17:46:59 +01:00
Allan Jardine
fb2f40a455 Removed: bScrollInfinite and iScrollLoadGap
- The infinite scrolling feature of DataTables is inadequate as a
  solution for the problem it is trying to solve as it introduces a
  number of compatiblity issues with the rest of the API parimarily
  due to the fact that it "tricks" the rest of DataTables into drawing
  just a small proportion of the table, leaving the elements which are
  currently in place. This means that DataTables doesn't realise that
  the table has additional rows at the top of the table, thus breaking
  numerous interactions with the API and confusing developers. As such,
  its a poor feature that is just taking up space and could be done much
  better externally.

- I will write an infinite loading feature for DataTables in future for
  users that do what to use this ability - there is nothing stopping a
  simple scroll event being attached to the scrolling element and
  calling the rows.add() function. This is exactly what the new plug-in
  will do.

- Scroller is a much better solution for defined length tables.
2013-10-10 17:46:48 +01:00
Allan Jardine
c31d3a1447 Dev: Refactor the filtering HTML creation function - save 138 bytes on
file size
2013-10-10 17:46:36 +01:00
Allan Jardine
3795134856 New: Default Ajax source property updated to be data
- In keeping with the camelCase name changes for DataTables 1.10, the
  default Ajax data source object property name has been updated from
  `aaData` to just `data`. Note that this is a fulyl backwards
  compatible change - if aaData is present in the data, it will be used.
2013-10-10 17:46:26 +01:00
Allan Jardine
fe1a5a630a Dev examples - Update ajax examples for new data and improved
descriptions
2013-10-10 17:46:15 +01:00
Allan Jardine
c470d7bfda New: sFilterInput and sLengthSelect class options for the <select> and
<input> controls used by DataTables for length change and filtering
respectively.

- Bootstrap 3 requires a styling class be set directly on the element,
  so in order to correctly support Bootstrap 3, which we want to do, we
  need to have the ability to set these classes. This commit adds that
  ability
2013-10-09 14:57:45 +01:00
Allan Jardine
bef8374eed Dev fix: Sorting a filtered table was broken
- Because of the decoupling of the filtering and sorting, the filtering
  was missing that the indexes of the displayed data will have changed
  after a sort. So need to do a full filter when just sorted
2013-10-09 14:57:34 +01:00
Allan Jardine
a11eb6d696 Dev fix: Error in full pagination type - missing first and last
buttons
2013-10-09 14:56:24 +01:00
Allan Jardine
6bd699b537 Dev fix: iDataSort and aDataSort conflicting on camelCase
- Simple fix is to check if it is a number or not
2013-10-09 14:56:12 +01:00
Allan Jardine
8573d5955c Update - init: scrollX can be set as true
- scrollX was often the source of frustration when setting it to
  anything other than "100%", which is was in the demos and
  documentation but it makes it easy to see that you could set it to be
  50% or anything else. That usually broke the developer's layout. So
  now you can just use scrollX: true, to enable horizontal scrolling.
  The demos have been updated for this.
2013-10-09 14:56:01 +01:00
Allan Jardine
76ae8661c8 Dev: JSON API - store and return the original JSON object
- Rather than creating a new JSON object from the XHR, use the one that
  was returned by the server. This is useful if you manipulate the data
  since you want to just keep using the same object.
2013-09-23 11:45:23 +01:00
Allan Jardine
7c1d27ae5f Dev fix: HTML-5 attr detection could provide undefined functions
- The HTML5 attribute detection for sorting, filtering etc was breaking
  if you didn't provide a filtering _and_ sorting attributes since they
  created an undefined get data function, which causes DataTables to
  complain. Fix is to just check for a null value.
2013-09-23 11:45:14 +01:00
Allan Jardine
5a3401ee5b Fix: Add support for the input, paste and cut events in the filter input
- IE10 has a little `x` to clear text boxes which fires the `input`
  event, so we need to monitor for that in the filtering input.

- While I'm here, I've also added support for the paste and cut events
  to change the filtering when they fire. Via keyboard the fire on
  keyup, but not if you use the mouse. They do now.

- Not that it us possible to have multiple events fire (keyup + paste
  for example). The logic of checking for a change of input counters
  this.

- Thhis fixes DataTables/DataTables issue #227.
2013-09-23 11:45:06 +01:00
Allan Jardine
4e5cad9640 Size: The default formatNumber method has been reduced in size.
- Exactly the same functionality, but now uses a regex to perform the
  same operation
2013-09-23 11:44:58 +01:00
Allan Jardine
e61e402e37 Performance: On destroy, don't select tbody elements for event removal
- Based on thread 17024 - if you have a large table with a lot of
  elements in the tbody, the find('*') selector was of course selecting
  them all. That results in poor performance. DataTables doesn't add any
  events to the children in the tbody, so we can filter out those
  elemetns and keep the element list ot  a sensible size.
2013-08-23 10:11:42 +01:00
Allan Jardine
4d6081c3d2 Performance - HTML decode uses DOM directly rather than jQuery to speed things up
- Based on the discussion in forum thread 16961 and the results from
  http://jsperf.com/html-decode I've updated how the HTML decode for
  filtering is done to bypass jQuery and use DOM methods directly. It is
  more code but it is also much faster.
2013-08-22 09:30:02 +01:00
Allan Jardine
74a78b2010 Accessibility: Add live region attribute to table info, remove from table
- Based on feedback from Rich Caloggero in forum thread 13421 the ARIA
  live region DataTables was adding to the TBODY element of the table
  have been moved to the table information element, so screen readers
  don't go mad announcing the new informaiton in the table on every
  change, but rather just read the summary.
2013-08-20 15:58:38 +01:00
Allan Jardine
5ca931c23b Fix: null handling for type detection and filtering methods
- The built in filtering formatters and type detection need to be able
  to handle just about any data being passed into them. They were
  tripping up with null data being passed in before.
2013-08-20 15:01:51 +01:00
Allan Jardine
a798d53d17 Merge branch '1_10_wip' of github.com:DataTables/DataTablesSrc into 1_10_wip 2013-08-20 15:01:34 +01:00
Allan Jardine
e6840bd2cf New: Pagination language options (i18n) have _PAGE_ and _PAGES_ options
- Based on the discussion in forum thread 16938 DataTables now has the
  ability to use _PAGE_ and _PAGES_ in addition to the exisiting
  _START_, _END_, _MAX_ and _TOTAL_ options in the information language
  strings. This allows the developer to show paging information rather
  than record based information in the information element.
2013-08-20 15:01:25 +01:00
Allan Jardine
425eb38c5b Dev fix: API page.info().page should use 0 as the start index not 1
- Math.floor should be used to have page indexes starting at 0 rather
  than 1, since page(n) uses 0 based indexing.
2013-08-20 15:01:17 +01:00
Allan Jardine
e1f4a8fa9e Use named module for AMD include
Based on DataTables/DataTables/issues/214 this commit uses the optional id parameter for the AMD define function to give DataTables a 'name' for easy referencing.
2013-08-20 15:01:10 +01:00
Allan Jardine
d5eb393df9 New: DataTables tables resize automatically with window (and width="100%" attr)
- DataTables tables previously did not automatically adjust their sizing
  when the window width was changed, which let to a lot of additional
  calls to fnAdjustColumnSizing in peoples code (and support questions
  in the forums). This commit add adjustment to the sizing automatically
  for tables width have width="100%" as an attribute (we can't use CSS
  since we can't know if it is relative or absolute sizing) - extending
  what went before. This has full compatiblity with scrolling and
  non-scrolling tables. A throttle is used to not bring IE to its
  knees...
2013-08-14 12:15:18 +01:00
Allan Jardine
b00180b71e Dev fix: fnAdjustColumnSizing was reseting paging
- The shim layer call to api.draw() was telling the API to reset the
  paging, but it should have been holding it static (as it now does by
  passing false in to draw()).
2013-08-14 09:07:15 +01:00
Allan Jardine
c05d26fcb9 Dev fix: Spell _unique correctly in ext! 2013-08-09 12:06:43 +01:00
Allan Jardine
cbeaadcba8 Dev fix: Additional to the content-box fix form the other day - use
jQuery since browser specific styles can override the W3C option. jQuery
deals with it for us.
2013-08-08 14:51:51 +01:00
Allan Jardine
4c317c910a New - event - column-sizing - fired when the column sizing chages
- This event allows plug-ins (specifically FixedColumns in this this
  case is what I'm thinking of, but others such as FixedHeader could
  also benefit) to alter their layout when the column sizing is changed
  (for example by a window resize).
2013-08-06 10:26:05 +01:00
Allan Jardine
ac7fb22620 New: New event - column-sizing - fired when 2013-08-06 10:25:57 +01:00
Allan Jardine
f817e9a0be Dev fix: State saving was breaking on sort
- My fix a while back for detecting if a column was no longer available
  in a table was duff, since it used $.map which flattens its array
  return, but sorting needs a 2D array.

- Fixed by doing our own itteration
2013-08-06 09:08:10 +01:00
Allan Jardine
6447373eb6 Dev fix: Update filter formatters to deal with null / undefined data 2013-08-05 15:40:50 +01:00
Allan Jardine
38e12beac9 Fix: Arrays in settings object shared between instances
- Because of the way _fnExtend() was deep copying objects, but shallow
  copying (i.e. references) arrays, the arrays used in the settings
  object were actually being shared between all instances of DataTables
  on a page.

- This is most noticable in the column filtering, whereby if you apply
  a filter to the column of one table, it is applied to all tables!

- The fix is to dump _fnExtend and replace it with a typical jQuery
  extend. However, one special consideration is made for the data being
  passed it - we absolutely do want that reference to be retained (that
  + the fact that extend is slow on large arrays/objects) so it is
  dumped into a temp variable which is then assigned back to the cloned
  object.

- This fixed DataTables/DataTables issue #213
2013-08-05 09:04:23 +01:00
Allan Jardine
a242a848d5 Fix: Individual column sorting was not distinct for multiple tables
- The `settings.aoPreSearchCols` array was being shared between every
  table on the table (test using a simple:
    $.fn.dataTableSettings[0].aoColumns ===
    $.fn.dataTableSettings[1].aoColumns
  ) which meant that a column filter aplpied to one table would be
  applied to all others.

- Fix is to deep copy the search model when adding a columns

- Fixes DataTables/DataTables issue #213
2013-08-04 10:16:28 +01:00
Allan Jardine
3f79e6cce4 Fix: box-sizing: border-box would cause column misalignment when scrolling
- It is far from uncommon to do `* { box-sizing: border-box; }` at the
  top of your CSS these days, including in frameworks, but this could
  cause DataTables a little bit of a problem when scrolling both
  horizontally and vertically since the padding it adds to the header
  linear element to allow it to scroll over the vertical scrollbar would
  be folded into the width of the div linear, rather than added to it.

- Fix is to simply set the box-sizing for the linear. I've decided to do
  this in Javascript rather than CSS since it is going to be needed
  regardless of the CSS being used.
2013-08-04 09:26:02 +01:00
Allan Jardine
f9ac4c64e2 New: Currency, formatted numbers and HTML numbers sort types built in
- This commit sees the number of built in type detection and sorting
  functions increase to cover the most common cases of use of plug-ins
  for DataTables (witht he exception of dates, for which a new first
  class plug-in will be created). Specifically, DataTables now has built
  in support for:
  - Dates (Date.parse())
  - Numeric sorting
  - Formatted numbers sorting (including currency and thousands
    seperators)
  - Numbers wrapped in HTML (link tags for example)
  - Formatted numbers in HTML
  - HTML

Although the numeric sorting plug-ins could have been collapsed down to
just two plug-ins (rather than 4) I decided to do it this way to allow
type based filter formatters to be used with the formatted number types
to allow search for "100,000" or "100000" to match the same data. This
is not built in, but it is possible (and might be in future).

- The goal with these additional functions is to enhance the abilities
  of DataTables out of the box to cover the most common cases for data
  usage - DataTables is all about making data in tables more accessable
  after all! The size cost is ~300 bytes for these additional functions
2013-08-03 08:08:38 +01:00
Allan Jardine
59c6b530f3 Fix: A default for mData would not have been applied
- Fix for DataTables/DataTables issue #212
2013-08-03 08:06:54 +01:00
Allan Jardine
382482f8e9 Update: If there is no sorting methods for the column type, use string
- In the case of filtering, if there is no filtering extension for the
  column type, then the basic string based filter formatting is
  performed (i.e. string is always the fallback - there can't be an
  error because a function isn't there).

- This commit matches that behaviour in sorting. If you define a column
  type as something for which there is no column sorting function, then
  the string type will be used rather than resulting in a javascript
  error.
2013-07-30 19:06:44 +01:00
Allan Jardine
c95f8c88d6 Size: Remove _fnColumnOrdering and replace with a _pluck call 2013-07-30 19:06:32 +01:00
Allan Jardine
16dea34d8c Update: Rewrite of column type detection
- Automatic column type detection was a real weak point of v1.9- - it
  did basically work, but if you then updated a row that didn't match
  the current data type it would always end up as a string. A good
  example of this is the ambiguous date "06-06-13" (is it dd-mm-yy or
  mm-dd-yy?). If it was detected as dd-mm-yy and then you add '05-20-13'
  to the column (or update an exisiting cell), the type would not match
  the exisiting value that thus failover to a string.

- Type detection is now more rigorous, but still optimised (since it
  has the potential to take up a significant amount of time). When a row
  is added or updated, or a cell is updated, the exisiting type is
  removed from the target column(s) and then, before sorting or
  filtering, the _fnColumnTypes function checks to see if any column
  needs to be type detected and do so if needed. This approach allows
  multiple rows to be added (for example) before the draw is performed and
  the type actually needs to be calculated.

- In future I'd like to have a 'data-ready' type event which will tell
  DataTables, and any of its components that something wants to work with
  the data in the table and it should prep the data. The counterpart would be
  a 'data-invalid' flag which would be set on update, add etc so it knows
  when an update is needed.
2013-07-30 19:06:25 +01:00
Allan Jardine
d9ce185f35 Dev fix: oApi backwards compatiblity issue
- The oApi option wasn't being attached correctly to either the settings
  object or the instance, so plug-ins were breaking. This adds the alias
  back in.
2013-07-26 15:55:40 +01:00
Allan Jardine
5e0e5ea5e4 Dev fix: Single column sort when not shift clicking the column
- If you were multi-column sorting, and didn't have shift depressed and
  click on the first column in the sorting priority, the multi-column
  sort would be retained. Non-shift click on any of the other columns
  would reduce to a single column sort, so match here
2013-07-24 15:09:37 +01:00
Allan Jardine
b7c6c98031 API: Update to extension API for camelCase support and tidy up
- This is a fairly far reaching commit in that the DataTables.ext object
  is updated to primarily use camelCase, just like the rest of the 1.10
  API. The old notation is still available for compatiblity, but
  deprecated.

- While working in this area, I've made a number of updates:

  - .model.ext has been removed - that was redundant and not useful.
    DataTables.ext is where the plug-ins for DataTables will live and
    will be correctly publically documented as such.

  - Type based actions (detection, sorting and filter) now live in a
    `type` namespace to make it clear that they are type based.

  - Internal references to .ext updated to use the new parameters. We
    could use the old ones since they are fully backwards compatible,
    but I'd rather set the standard by using the modern ones.

  - JSDoc comments for .ext updated

  - Extension examples updated
2013-07-24 14:51:01 +01:00
Allan Jardine
36f720ca60 Dev fix: Volumne visiblity with scrolling enabled would misalign columns
- When creating the new visiblity methods, I forgot to have the table do
  a scroll draw to have the columns align correctly for the header and
  body. This commit fixes that.

- Also update the column visiblity example to use jQuery events rather
  than DOM0 events.
2013-07-23 10:47:54 +01:00
Allan Jardine
c822eefc4e Update: When Ajax loading data, now automatically ajust column sizing
- Previously you'd need to use initComplete and columns.adjust() to take
  account of the data that was loaded by Ajax. Now this will be done
  automatically. It does mean a few more clock cycles, but I think
  that's a tradeoff that is worth it.
2013-07-23 10:17:43 +01:00
Allan Jardine
c750514e98 API: Static methods updated for DataTables 1.10 camelCase
- Alias the static methods to camelCase and hungarian varients:
  - versionCheck()
  - tables()
  - isDataTable()

- Small updates in styling of the static functions
2013-07-23 10:17:32 +01:00
Allan Jardine
78e4d32e30 New: cache() methods for rows and cells.
- I'd previously added columns().cache() which gets the cached
  information about filtering or sorting, but this rounds the API off,
  extending that also to rows and cells:

  - rows().cache()
  - row().cache()
  - cells().cache()
  - cell().cache()
2013-07-22 17:58:08 +01:00
Allan Jardine
de1ec231cd Dev: Fix issue whereby you couldn't order with a click on a column after using order() API
Fix: I've removed the third entry in the aaSorting array, as the issue
was that after using order() that entry wasn't present. It was a bit
confusing as well, so it is now replaced with a property (_idx on the
aaSorting entries) which indicates the current sorting index (in
asSorting) - and this property is optional. If not given, it is looked
up or 0.
2013-07-22 16:04:01 +01:00
Allan Jardine
572e0ca9b9 Build: Usage for the make script 2013-07-22 15:28:06 +01:00
Allan Jardine
182eadf213 API: Column selector now allows {integer}:visible
- This is an alias of `{integer}:visIdx` which should be a little easier
  to remember.
2013-07-20 10:50:35 +01:00
Allan Jardine
e8c3a0b96a Dev: New .datatables-commit-sync which is going to be used by the
build and commit scripts to keep the src and build repos in sync.

Dev: Update the dataTables main file to the latest build which was
accedentally committed. Just a couple of little dev fixes - no API
changes.
2013-07-19 15:17:26 +01:00
Allan Jardine
3ed88a9c87 Repo: Starting the split of the src and build repos.
- DataTables/DataTables is now going to be a build mirror of
  DataTables/DataTableSrc which will host the source core. Scripts will
  be used to build the generated files as there will be a number of
  these now (examples, JS, CSS, web-site documentation etc).
2013-06-27 21:22:56 +01:00
Allan Jardine
338b5e81cf New: columns().nodes() and column().nodes() methods
- Previously there was columns().cells() and column().cells(), but these
  were removed in f0a73ce due to the changes for the new top level
  cell() and cells() selector methods.

- This commit effectively re-instates those functions but under the
  `nodes()` name, matching the row and cell selection options. This is
  for completeness in the API.
2013-06-25 08:27:49 +01:00
Allan Jardine
4e04d1e977 Build latest changes 2013-06-24 22:15:42 +01:00
Allan Jardine
76e572985d Build latest changes 2013-06-21 07:38:46 +01:00
Allan Jardine
1a880b9f46 Dev: All the latest changes now built 2013-06-19 17:34:49 +01:00
Allan Jardine
a070ccc2b3 Build - latest changes 2013-05-29 09:13:49 +01:00
Allan Jardine
748f8634cd Dev: All the latest changes built into the main file 2013-05-26 19:52:23 +01:00
Allan Jardine
34f86db782 Build update - all the latest changes, compiled into the source file. 2013-05-25 08:21:55 +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
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
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
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
c2dd657fa8 remove hacking 2013-03-04 08:43:11 +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
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
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
1bb4fc6896 Dev fix: Typo from a67ff2f 2013-02-26 21:33:00 +00: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
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
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
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
076744a84c Merge branch 'master' of github.com:DataTables/DataTables 2012-12-21 09:36:10 +00: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
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
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
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
Allan Jardine
ec10497217 Dev: Update generated file from the marges made recently 2012-10-07 12:23:24 +01:00
Allan Jardine
a0455fa858 New: The primary public interface for DataTables' initialisation options is now camel case parameters rather than the Hungarian notation that was used before. There are a number of reasons for doing this, the primary one being that the Hungarian notation used by DataTables is actively stopping people from using the library due to their aversion to using Hungarian notation. Without doubt the Hungarian notation used was a mistake (the reason it was used was that when DataTables was originally written, the company I worked for at the time required the use of Hungarian notation, and thus I was trained in it...).
Backwards compatibility issues: The main goal here (other than to use camel-case notation!) is to preserve backwards compatibility. Unfortunately this isn't 100% possible:
	- DataTable.defaults.columns has been renamed to be DataTable.defaults.column
		- Otherwise it conflicts with aoColumns in the defaults.

Without doubt this is going to be a long process - for example the unit tests and examples need to be completely updated for this change. The JSDoc comments have been updated, so the site should take care of itself for the most part, when released.

In terms of implementation, it is important to note that I have not broken backwards compatibility here - the way it is does is that the current defaults are retained, and a camel-case to Hungarian mapping is automatically generated and then applied to the objects given by the end user. This adds around 0.5K to the size of DataTables, but writing the mapping manually would require at least 3K, and changing DataTables wholesale to camel-case would utterly break backwards compatibility. This is the least 'evil' way to accomplish this. It is important to note that this is a step along the roadmap for DataTables - come v2 Hungarian notation will likely be dropped completely.

One important note to make about this mapping is that if you use camel-case DataTables will copy the value from the camel-case properties to their Hungarian counterparts, so you will end up with additional properties on your source object. As I say, this appears to be to be the least 'evil' option, although still not perfect itself. The challenges of working with legacy software and installs...!
2012-10-07 11:50:29 +01:00
Allan Jardine
c14b49fca3 Remove - asStripClasses backwards compatiblity. There was a typo for asStripeClasses back when it was first introduced, now here in 1.10 the patch that was used to allow both forms is removed. 2012-09-30 09:22:06 +01:00
Allan Jardine
6b605936f7 Update: Significant update to how sorting is applied internally in DataTables - there is no difference to how the sort is actually done, with the single exception that the -asc and -desc are not depricated in favour of the -pre method only.
- With the introduction of the -pre method in DataTables 1.9, the -asc and -desc sorting functions became more or less redundant since they are simple comparisons (all of the complexity is now in the -pre formatting function). As such the call to the -asc / -desc method is overhead that really isn't needed, and this commit introduces a sort function that doesn't call the -asc / -desc methods, instead just doing the comparison itself. In tests, this relatively simple change leads to a performance improvement of around 15% in all browsers (it also has the side benefit of less operations, so IE8- will be able to sort larger tables before flagging up a slow script warning).

- We can't just remove the sorting method which will call -asc / -desc though since not all sorting plug-ins will have a -pre method. Therefore, for backwards compatiblity the old sort function (albeit updated for the changed variables) is retained. The backwards compatibality code adds around 300 bytes to the library, but this is an unaccounced change, so backwards compatiblity must be retained.

- The old sort method will be removed in v1.11. The -asc and -desc methods are now fully depricated.

- Altered the sorting method to flatten the aaSorting array since the introduction of aDataSort in v1.9 required an extra loop in several locations. The functionality is very useful, but the extra loop can be a bit messy and slightly hit performance, so it is now flattened to be a single array (with object information so it makes sense, rather htan array indexes!).

- Altered the order of sorting when building _aSortData since it was looking up the same variable smultiple times which really wasn't needed.

This is part of a small incremental changes plan for DataTables! There are still a huge number of things to improve in this area, but this is a nice clean up and a nice 15% sorting performance improvement to get us started :-).
2012-09-29 21:25:41 +01:00
Allan Jardine
36076fc5c8 Removed: sName reordering on return from the server when server-side processing. This was depricated in DataTables 1.9 and is now removed. This was an inefficient way to supply data to the DataTable in an array that was out of order and the client-side would reorder the arrays into what was needed. The way to do this now is to use mData and JSON objects rather than arrays, as it provides much greater flexibility without a performance hit on the client-side.
Note: _fnColumnOrdering is left in place at the moment, although it may be updated as work progresses on 1.10 with regard to the increased use of column names.
2012-09-23 18:49:11 +01:00
Allan Jardine
8d56d0204e Starting DataTables 1.10 development :-)
Removed: fnRender - fnRender was depricated in 1.9 and is now being completely removed here. Its always been a bit messy and is now superseded by mRender. The main reason for this is that DataTables use to take an independent copy of the input data source object / array. This is a performance hit and it means we can't do any binding to external objects (for example it makes Knockout integration almost impossible).
Removed: bUseRendered - with fnRender being removed, bUseRendered is irrelevent
Updated: With fnRender being removed we no longer need to take an independent copy of the data source object / array (since DataTables itself isn't ever going to write to it now - fnRender did and the copy was included so we didn't inadvertantly change a developers data source object without them knowing about it. This is no longer a problem, and in fact having it use the same data source object is extremely useful in many cases.
2012-09-23 18:38:25 +01:00
Allan Jardine
822c62d05d DataTables 1.9.4 2012-09-23 14:16:14 +01:00
Allan Jardine
26d2926390 Fix: Ie9 throws an error when document.activeElement is used inside a frame or iframe... So need to wrap the test up in a try/catch. Nasty. 2012-09-23 13:12:39 +01:00
Allan Jardine
b4cd9f11c6 Fix: A header made of only TD elements wasn't being correctly detected - 11705 2012-09-19 07:27:11 +01:00
Allan Jardine
d1142e1450 Fix: If the user is currently focused on the filtering input element, don't overwrite the value that is already shown as this will effect the cursor position. 2012-09-16 12:00:36 +01:00
Allan Jardine
a19e1dee12 Dev: Use className for the newly created TR - slightly faster than addClass which isn't needed here 2012-09-16 11:19:53 +01:00
Allan Jardine
e25b377ee8 Fix: State saving deletion of cookies was somewhat broken. It would delete cookies out of order, which is not what we want. Rewrite how the 'overage' of cookies (4K limit) is handled 2012-09-13 18:13:32 +01:00
Allan Jardine
a43714bfba Fix - docs: sNext and sPrevious referened to full_numbers pagination type, but they can be used for any pagination control: 9192 2012-09-12 07:47:29 +01:00
Allan Jardine
66e92ab655 Fix - docs: Documentation error for fnGetPosition - missing one of the return indexes - 11708 2012-09-11 10:09:03 +01:00
Allan Jardine
ca96ed55d5 Fix: Remove irrelevent and broken bSortable check for the column options - fix issue #101 2012-09-11 07:04:41 +01:00
Allan Jardine
0a3793b4bb Dev: Tidy up the way that the header and footer elements are 'got'. Based on pull request #92. 2012-09-09 18:43:57 +01:00
Allan Jardine
df614240cf Update: Fully deprecate fnRender - it will be removed from the next major version of DataTables and it is strongly adviced that you do not use it! 2012-09-09 12:26:57 +01:00
Allan Jardine
880de42c6e Dev: Remove debug from last commit... 2012-09-09 12:05:20 +01:00
Allan Jardine
555aacfc6d Fix: mRender and mData now work in the same way for DOM sourced tables as they do for JS sourced table data. Generally we wouldn't really expect them to be used as much for DOM sourced tables (if you want your table formatted differently, you'd just create the HTML differently!), but it can sometimes be useful to use these options. This also brings mRender to full 'pace' ready to be used in complete preference to fnRender (alongside the other methods for cell rendeirng such an fnCellCreated etc). 2012-09-09 11:57:02 +01:00
Allan Jardine
59dc2aed9c Dev: Fix a couple of issues that were introduced in pull request #85 - 1. Mix of spaces and tabs :-). 2. documentation generation was broken due to the use of another closure, 3. minification was broken as window, document, undefined were been aliased and 4. jshint was throwing errors. This addresses those issues, primarily by shifting the closures around. 2012-09-02 10:33:49 +01:00
Allan Jardine
e69e3c6c1c Dev update: Commit built changes from Tim Tucker from last few merges 2012-09-02 09:49:17 +01:00
Allan Jardine
0d47107906 Merge pull request #84 from timtucker/master
Update to docs
2012-08-31 09:46:34 -07:00
Tim Tucker
08619a3a21 Update media/js/jquery.dataTables.js
Update doc to reflect that _fnGetWidestNode returns a node, not a string.
2012-08-31 10:48:55 -03:00
Allan Jardine
c2af41140b Performance: Large improvement in scrolling performance due to rearranging the way that column widths are read and applied to the target table. Rather than merging reading and writing together, we now seperate the reading and writing phases, allowing the browser's rendering engine to optimise the reflow. Props to jlabanca for this modification - 11541 2012-08-30 07:29:50 +01:00
Allan Jardine
9f8d2a632b Moving on to 1.9.4 development 2012-08-22 16:41:52 +01:00
Allan Jardine
34096537c2 Fix: Firefox Windows (not Mac) had an error when calculating if scrolling oversizing was needed or not (_fnBrowserDetect). The result was that the table did not fill the space when y-scrolling was enabled and Firefox Windows was used. Fix is to remove the height on the DT_BrowserTest parent as suggested by randomuser - 11406 2012-08-22 16:39:36 +01:00
Allan Jardine
b16efbc62a DataTables 1.9.3 :-) 2012-08-08 22:39:39 +01:00
Allan Jardine
725c1b68ba Fix: Typos in documentation comments and source comments - 11083 2012-08-08 22:22:45 +01:00
Allan Jardine
1f0b162760 Dev fix: In the update to the search array building methods I neglegted to strip \n\r from all rows (only HMTL rows were being stripped) - this is required for searching to work as expected. Picked up by the unit tests. 2012-08-08 22:05:14 +01:00
Allan Jardine
fd0e0a42e4 Fix #39 - null values should also be considered like undefined values when working with nested data and have properties created as needed. 2012-08-08 20:16:40 +01:00
Allan Jardine
9a7613362f New: xhr event now has the json returned from the server as the third parameter. 2012-08-08 16:29:27 +01:00
Allan Jardine
9c51aa0ad7 New: xhr event 2012-08-08 16:27:42 +01:00
Allan Jardine
320f53e217 New: When making an Ajax call for data (fnServerData) and the server responds with the JSON parameter "sError" set, Data
Tables will alert this out. Typically end users should never see this - it is useful for error reporting from the server
 though.
2012-08-06 20:41:49 +01:00
Allan Jardine
ed935f3fb8 New: When making an Ajax call for data (fnServerData) and the server responds with the JSON parameter "sError" set, DataTables will alert this out. Typically end users should never see this - it is useful for error reporting from the server though. 2012-08-06 20:39:57 +01:00
Allan Jardine
45a6d2b505 Fix: null values that were applied to extended object properties were not being correctly applied since typeof null === 'object' - 11180 2012-08-04 09:34:26 +01:00