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

1239 Commits

Author SHA1 Message Date
Allan Jardine
60273a0a75 Dev: Update the new rowId option to be able to read the id from the DOM 2015-08-12 19:49:29 +01:00
Allan Jardine
9cc3be030f Fix: Calculation for horizontal scroll bar adjustment when the dt-init scrollCollapse parameter is set could be incorrect when the standard height exceeds the window height.
- This is an interesting one, and I suspect a bit of an edge case in the
  browsers - what is happening is that the window is going from having a
  scrollbar to not having a scrollbar when the scrolling viewport is
  collapsed. This causes the browser to show the scrollbars in the
  viewport for an instant, even although they aren't actually required.
  If the height of the viewport is 53px and you up it to 80 so there are
  no scrollbars and reduce it back to 53 the scrollbars are gone! The
  browser must be stopping a race condition once the scrollbars are
  shown.

- The fix is to use `max-height` for the scrolling container if the
  scroll collapse is set and `height` otherwise. The browser native
  methods makes the code _much_ easier to work with, more performant and
  easier to understand.
2015-08-10 17:47:34 +01:00
Allan Jardine
07c04c69f8 Dev fix: Commit f2df0716 removed a check for IE6/7 to disable the smart
column width for these tables. However, that was in error - it is in
fact required still as the smart width calculations cause the browser to
crash (APPCRASH). There is no indication as to why this is, not is it as
simple as just disabling one or two pieces of code to stop the crash.
This leads me to suspect that it is the number of operations being
performed - particularly to do with the cloning of the elements. If this
is the case, then its just never going to work. Also IE6/7 are such a
small market now (thank goodness) this is just a feature that won't be
available in those browsers.

If anyone is interested in working on fixing it, or paying me to do so,
I'm happy to hear from you :-)
2015-08-10 17:47:12 +01:00
Allan Jardine
d0e9e78db4 Fix: Horizontal scrolling could incorrectly be triggered in Firefox when there is lots of room available and scrolling is not required. This was due to sub-pixel rendering of the columns, but the widths being rounded up to integer values. Using getBoundingClientRect addresses this. IE8- have to continue using the old method.
Fix: The auto width calculation table, when scrolling is enabled, being inserted into the scrolling container could cause the viewport to scroll, even when the main table doesn't actually need scrolling. This causes the column width calculations to be incorrect by the scrollbar's width. The fix is to have the calculation table `position:absolute` in the scrolling container and height:1px so it has no effect on the vewport's scrolling.

- These two fixes address DataTables/DataTables #612. Kudos to @Delgan
  for reporting these issues and supplying test cases - thanks!
2015-08-10 14:59:04 +01:00
Allan Jardine
bb33384e62 Update - styling: Altering the paging buttons to have a styling that is consistent with the Buttons extension. This is just a darkening of the active border and a small border radius. 2015-08-10 14:58:05 +01:00
Allan Jardine
201cc7fb69 Fix: If dt-init deferRender was enabled, the dt-event init event wouldn't trigger until after the table's second draw.
- This could be seen specifically when using Responsive with a defer
  rendered table - Responsive wouldn't kick in until after the second
  draw.
2015-08-06 20:42:01 +01:00
Allan Jardine
a2948e4c1e Fix: Simplification and improvement of table widths when scrolling
Fix: Table could overscroll if `dt-init data` is used to populate the table

This is a fairly significant change to how DataTables operates for the
scrolling width calculations and primarily is due to a simplification
with the use of `clientWidth` to get the scrolling container width.
Rather than getting the offsetWidth and then removing the scrollbar
width if required the `clientWidth` will give us the value directly.

With the scrollbar width already accounted for the scrolling draw code
can be updated to not need to account for it itself.

Finally, when using the `data` property to add data to the table we need
to recalculate the column widths after the first draw, just like with
Ajax loaded data, otherwise the data added won't be taken into account
and we can get an error in the scrolling.
2015-07-24 15:38:59 +01:00
Allan Jardine
11dbd3ca52 Fix: Mixed tabs and spaces 2015-07-24 11:45:08 +01:00
Allan Jardine
534e281b39 New: dt-api draw() now accepts a string parameter which can be used to perform a simple redraw without the need to reorder / research the table. This is useful for paging where, otherwise, it would be a performance hit. 2015-07-24 11:44:34 +01:00
Allan Jardine
d1352ac898 Merge branch 'master' of github.com:DataTables/DataTablesSrc 2015-07-24 11:43:09 +01:00
Allan Jardine
fcd96cc5e3 Fix - docs: dt-api rows().every() example was missing a parameter
- This fixes DataTables/DataTables #608
2015-07-24 11:42:49 +01:00
Allan Jardine
b61ac2a9db Resolve issue with focusing when there are multiple graphs updating on the same page 2015-07-24 11:42:12 +01:00
Allan Jardine
4222dec97d Merge branch 'master' of github.com:DataTables/DataTablesSrc 2015-07-15 17:10:41 +01:00
Allan Jardine
4b378ff787 Dev: Updating the XML for the external styling examples to use the new example build framework 2015-07-15 17:10:24 +01:00
Allan Jardine
821e866ac0 fix for incorrect calculation in _fnBrowserDetect
when body's position is changed (left: 375px) _fnBrowserDetect incorrecly calculates offsets. thus header is a bit misaligned. commit changes test object's position to fixed. in this case it's position will
be relative to the viewport not to the body.
2015-07-15 17:09:48 +01:00
Allan Jardine
1447c26a78 Fix: Potential memory leak when using static events on table elements and destroying tables
When the table was being destroyed and the remove parameter was passed
in as `true` to remove the table from the DOM there was potential for
bound events to not be unbound from the table elements. This was caused
by the use of the `detach` jQuery method which will not remove events.
Furthermore, rows would not be added to the table before this method (or
`remove()`) was called. As such we need to reorder the code slightly -
attach the rows back into the DOM and then remove them (or detach if the
table is left in the DOM) - otherwise rows which were hidden by paging
would not have their events unbound.

Many thanks for KnowledgeNet ( http://kn-it.com/ ) for their support in
finding and allowing this bug to be addressed!
2015-07-09 10:21:10 +01:00
Allan Jardine
549bd19854 New: Optimised ID selectors - Also works when rows have not yet been rendered.
Being able to get and keep a reference to each row is quite important.
You can't use the DataTables row index for this as it can potentially
change, but we can use IDs, based on a unique value for each row in the
data - `dt-init rowId`.

I've made the decision to not require escaping of data in the ID. This
means that selectors can be ID selectors with a cobontation of other
things (#div.class for example) as that really doesn't make much sense
in this contact - you only have rows that you can select from. Not
requiring escaping makes both the client and library code much easier.
This is documented.

The implemention is to store a reference to each row's data object based
on its id allowing for a trivial lookup. The object has its own index
in the `aoData` array, so there is no `indexOf` required. The only
downside is that the index must be updated when a row is deleted. This
is done with a trivial for loop.
2015-07-06 21:05:27 +01:00
Allan Jardine
abc683d393 Dev: dt-api rows().ids() and dt-api row().id() methods should return undefined if a row's id is undefined 2015-07-06 21:05:08 +01:00
Allan Jardine
7e2c6b4d0f New: dt-api page.info() includes a new parameter to indicate if server-side processing is being used or not for the table 2015-07-06 21:03:56 +01:00
Allan Jardine
dda351a54e Fix: Row details could potentially throw an error if used on an row that doesn't exist (might have been removed) 2015-07-06 21:03:39 +01:00
Allan Jardine
29fd57569a New - dt-api $.fn.dataTable.tables() can now return an API instance which makes for easy chaining to call methods on the selected tables. This is done by now being able to provide an object (providing two booleans is confusing unless you have the manual right next to you!) 2015-07-06 21:01:47 +01:00
Allan Jardine
36929eade3 Fix: Initialisation on an element other than table would result in a Javascript error
* Issue was that an `error` event was being triggered before the
  settings object had been configured. There is no option to trigger an
  error event in this case.
* Fixes DataTables/DataTables #572
2015-06-10 09:48:45 +01:00
Allan Jardine
5a47fe5a9b Merge branch 'master' of github.com:DataTables/DataTablesSrc 2015-06-10 09:48:26 +01:00
Allan Jardine
dd6612f24a New: dt-event preInit event - emitted while a table is being initialised, allowing developers to modify the data being requested by DataTables for the first draw of the table. Used by Scroller 1.3.0 and likely will be by other extensions soon. 2015-06-10 09:48:06 +01:00
Allan Jardine
4cd2132607 Dev: Remove comments from SCSS file that are redundant 2015-06-10 09:47:44 +01:00
Allan Jardine
a5613441dc Dev: Add Scroller as a framework library 2015-06-10 09:47:23 +01:00
Allan Jardine
1effb64cfa Fixed event handlers in table headers in IE8
On line 605, column.sTitle is set to the TH's innerHTML.
On line 1816, column.sTitle is compared with cell.html().

If you have child elements with event handlers on them inside the TH, these are not the same in IE8 (see https://gist.github.com/simonbrent/933e552739477f4be3ab#file-test-html)

As a result, the check on 1816 fails, the contents of the cell is replaced, and the event handlers are removed.

Comparing instead with cell[0].innerHTML fixes this issue.
2015-06-10 09:45:55 +01:00
Allan Jardine
cf1e9d1fab Fix: dt-api ajax.reload() should cancel an exisiting request if that request has not yet completed
- Thread 28197. Thank you _womplify_!
2015-06-08 11:13:56 +01:00
Allan Jardine
f9cdaead17 Dev: Fix trailing comma 2015-06-04 15:35:06 +01:00
Allan Jardine
801e4bedf1 New: dt-init rowId option to specify what property should be used from the row's data source object to read the row's id and then set it as the DOM id (previously this was static as the DT_RowId option)
New: `dt-api row().id()` and `dt-api rows().ids()` to get the id from one or multiple rows, based on the new `dt-init rowId` option
2015-06-04 15:26:45 +01:00
Allan Jardine
759ea3d733 Update: The dt-api rows().every(), dt-api columns().every() and dt-api cells().every() methods are now passed index and loop counter parameters 2015-06-03 17:07:55 +01:00
Allan Jardine
d95820dd2a New: dt-api count() method. This provides a short cut method to determine how many items have been selected by the API. This can be useful to count the number of selected rows, etc. 2015-06-03 17:07:17 +01:00
Allan Jardine
4f3525786d Update: Add postfix option to the number renderer option 2015-06-03 17:06:58 +01:00
Allan Jardine
f817194a09 Fix: If the paging language options were set to be an empty string, the button wouldn't render. This is not correct as it doesn't allow CSS icons to be used rather than the strings. 2015-05-30 14:10:31 +01:00
Allan Jardine
3de8e7c3fe Merge branch 'master' of github.com:DataTables/DataTablesSrc 2015-05-30 14:10:12 +01:00
Allan Jardine
04598f91ff Fix - docs: dt-api row.add() and dt-api rows.add() will accept tr elements 2015-05-30 14:09:54 +01:00
Allan Jardine
feccbc5968 jq 2.1.4 sppt 2015-05-30 14:09:19 +01:00
Allan Jardine
59457b63e6 Fix example: Server-side processing data source example column titles were incorrect 2015-05-30 14:09:03 +01:00
Allan Jardine
09ff48a486 New: Add numbers paging option for dt-init pagingType to round off the full set of basic options
Thank you `rubenduiveman` for suggesting this enhancement
2015-05-13 13:51:23 +01:00
Allan Jardine
c61947f5f3 Fix: dt-init scrollX could not be given as false - it still enabled x-scrolling 2015-05-06 16:18:28 +01:00
Allan Jardine
7081a1a7c6 1.10.8-dev version flag 2015-05-06 11:31:46 +01:00
Allan Jardine
768f7cdc46 Fix: Disabling smart column width for IE67 as it can cause the browser to crash 2015-05-06 11:30:27 +01:00
Allan Jardine
17130d2fd5 Fix: When scrolling is enabled and column visiblity is toggled a Javascript error would occur due to the column width calculation method cloning the wrong header element.
This fixes thread 27612 and DataTables/DataTables issue #553
2015-05-06 11:30:10 +01:00
Allan Jardine
ded5ee322c Dev: Bringing the integration files for the various frameworks that DataTables supports into the repo
This is so each repo defines its own integration files, ensuring that
they are both easy to update and that they are up-to-date. I will be
blogging about this change next week.
2015-05-06 11:27:47 +01:00
Allan Jardine
fc64e71e1c DataTables 1.10.7 release 2015-04-30 15:08:43 +01:00
Allan Jardine
2f85ace4a1 Fix: IE6/7 could crash completely when using auto width due to a clone of a clone occuring. This was bad for performance anyway and has been rewritten to resolve both the IE crash and performance issue
See thread 27428 for further information
2015-04-30 14:01:55 +01:00
Allan Jardine
5484fdaec3 Fix: For convenience $.fn.dataTable.Api() will now automatically construct a new DataTables API instance (i.e. it is functionality identical to calling new $.fn.dataTable.Api(). This addresses an outstanding todo item and an error in instanceof logic for the exisiting constructor 2015-04-30 14:01:16 +01:00
Allan Jardine
362ec532f2 Dev: Update to jQuery 1.11.3 2015-04-30 14:00:53 +01:00
Allan Jardine
432a0dc18a New: dt-event xhr can now return true to have DataTables not trigger the dt-event error event for cases where you've handled the error yourself now that dt-event xhr is triggered on error as well 2015-04-30 10:02:16 +01:00
Allan Jardine
e4a12ed19d New: Always trigger the dt-event xhr event on completion of an Ajax request, regardless of whether it was successful or in error
New: The jQuery XHR object is passed into the `dt-event xhr` event as the fourth parameter

* This fixes DataTables/DataTables #542
2015-04-29 21:52:34 +01:00