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

913 Commits

Author SHA1 Message Date
Allan Jardine
323e40e729 Site: Add documentation for tech notes 1-5. 2014-01-14 15:47:22 +00:00
Allan Jardine
2891978fd1 Fix: Numbers incorrectly detected as dates in Chrome
- Chrome (V8) will incorrectly detect '$245.12' and similar as dates,
  since V8 will strip unknown characters from a string given to
  Date.parse and then attempt to parse the rest of the string - in the
  example above: Dec, 245:
    https://code.google.com/p/v8/source/browse/trunk/src/dateparser-inl.h#72

- The fix implemented to to check for a leading a-zA-Z, number or +-.
  Although this isn't a perfect match for what Chrome does, it, I think,
  a good enough effort to chatch nearly all particular use cases.

- Additionaly, V8 will try to parse a single number passed into
  Date.parse - 1-12 are months, 32+ are years. As such, the numeric type
  detection much be a highter priority than the date detection, since
  Chrome might incorrectly use a column as a date. It would sort
  correctly, but it isn't "correct".

- The take away from this is that Date.parse cannot be used for date
  format validation on its own...
2014-01-05 11:18:42 +00:00
Allan Jardine
cd0139927e Dev fix: sInputFilter class wan't being applied when using the _INPUT_
macro

Fixes DataTables/DataTables issue #260
2014-01-05 11:18:31 +00:00
Allan Jardine
0b2c32c98f Merge branch 'master' of github.com:DataTables/DataTablesSrc 2014-01-05 11:18:18 +00:00
Allan Jardine
b3bd3cbda7 Site: Add documentation for tech notes 1-5. 2014-01-05 11:18:05 +00:00
Allan Jardine
4a65fb054a Update: isDataTable() static method will now accept jQuery objects and
selectors as a parameter to check if it is a dataTable.

`tables()` static method rewritten for size
2014-01-05 11:17:53 +00:00
Allan Jardine
1ab67a880f Fix: When in server-side processing mode, the processing display was
being removed too early on click to sort column.

- Fixed DataTables/DataTables 259
2014-01-03 09:56:57 +00:00
Allan Jardine
292d021217 Dev update: Better fix for flatten()
- Smaller code and works with a mix of scalars and arrays
2013-12-28 17:05:36 +00:00
Allan Jardine
e5d8a40fc1 Dev fix: The flatten() method should only flatten 2D arrays, and not
1D arrays.

- The method implemented isn't actually 100% perfect - if you mix arrays
  and scalars, then the behaviour is undefined. But that shouldn't
  happen in DataTables. Will look into it further, though
2013-12-28 17:05:11 +00:00
Allan Jardine
e699f8b510 Dev fix: ext.order is an object not an array
Dev fix: `ext.order` wasn't being aliased back to afnSortData correctly
2013-12-28 11:22:49 +00:00
Allan Jardine
dc0fffa316 Dev: Remove debug 2013-12-28 11:22:37 +00:00
Allan Jardine
4cb532ad95 Fix: DT_RowClass wasn't being updated when modified in the data source.
- This is actually a little more complex than it might first appear
  since any classes which have been added by DT_RowClass need to be
  removed. We can't just bindly remove all classes, so we need to track
  that classes have been added in a private variable.
2013-12-28 11:12:05 +00:00
Allan Jardine
ab13fcfcfd Dev fix: Add renderer as an initialisation parameter
- The core logic was already present, it just wasn't in the defaults or
  available to be set in the init object
2013-12-27 22:43:44 +00:00
Allan Jardine
f3a7f909bb Dev fix: Background row colour was only being used if the display or
stripe class was added.
2013-12-20 12:01:27 +00:00
Allan Jardine
1fffb2f5d1 Dev fix: Fix error with stylesheet whereby the last row didn't have a
border
2013-12-20 12:00:47 +00:00
Allan Jardine
af287d50a2 Dev fix: The columning classes should be applied to the columns the user
has selected for sorting, not the data sorted columns (although they are
usually the same)

- https://datatables.net/forums/discussion/18714
2013-12-19 14:24:37 +00:00
Allan Jardine
cece4c7c18 Fix: Add jQuery to the anon wrapper function, so a different version can
be passed in if needed

- Based on the discussion in
  http://datatables.net/forums/discussion/18792
2013-12-19 14:04:25 +00:00
Allan Jardine
d7f487ad10 Update copyright license for SpryMedia Ltd 2013-12-19 14:01:19 +00:00
Allan Jardine
282f56e9bb License: Update to be MIT license 2013-12-11 17:20:42 +00:00
Allan Jardine
c95dd530b7 Dev: Add new _fnDataSource function to get the data source and simplify
some logic conditions
2013-12-11 17:20:31 +00:00
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
208b3ba6a1 CSS: Add border-spacing: 0 to the stylesheets
- This is the CSS version of the cellspacing attribute on the table in HTML. It will work in all browsers except IE6/7. IE8+ and the others are all fine. So for the moment most of my examples will continue carrying the cellspacing attribute, but this is useful to have in the core css
2013-11-25 09:23:57 +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