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

949 Commits

Author SHA1 Message Date
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
42170f6498 Dev styling - darken the paging button border slightly 2013-07-30 19:06:38 +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
175240613b Dev fix: Fix dependency for bower 2013-07-25 22:19:41 +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
379a746034 Dev styling: Lighten selected paging button colour
- Reversed the hover and active paging colours as the black was rather
  heavy by default
2013-07-24 14:50:51 +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
b75147b994 Dev: Sync to 5e444c7e09126c87965e69873fc5152fd097014b - the build script
was having a few sync issues
2013-07-22 17:57:14 +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
381f60858e Build: Package desciptors now held in a common location and built as
part of the build process.
2013-07-21 09:10:37 +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
2023aafd99 Dev: Update CSS file with the updated formatted used in the source repo 2013-07-20 10:46:30 +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
e84b102815 Dev: Fix error in fnDeleteRow shim 2013-06-25 11:39:47 +01:00
Allan Jardine
07f0a51ca8 Dev: Fix error in the mapping update 2013-06-25 11:39:31 +01:00
Allan Jardine
b7bbe0e1ff Merge branch '1_10_wip' of github.com:DataTables/DataTables into 1_10_wip 2013-06-25 10:09:33 +01:00
Allan Jardine
65efee3554 Docs - The new XML container for the examples has been updated to have the content of the <info> tag as markdown rather than XML / XHTML. I think this will probably be easier long term. 2013-06-25 09:56:00 +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
85a845aed2 Dev: Remove asDataSearch - its gone now 2013-06-24 22:02:27 +01:00
Allan Jardine
c1eeed8e1a Dev - refactoring _fnMap to improve compression. Saves about 500 bytes 2013-06-24 11:32:50 +01:00
Allan Jardine
cddcafc92d Dev fix: Wasn't correctly creating the element to insert a header row 2013-06-22 15:58:58 +01:00
Allan Jardine
fd10532f94 Dev: Altering how sort classes are applied to be a draw callback
- Previously the sort classes were being applied at the end of the
  _fnSort function, with a callback for when using deferred rendering
  and server-side processing (that was a performance hit for deferred
  rendering thinging about it, since it hapened twice).

- Now a single callback is used so sorting classes are applied only
  after the draw is done.
2013-06-22 14:08:53 +01:00
Allan Jardine
01444af1a6 New: Header renderers
- Rendering functions can now be provided for the header cells in the
  table, which will format HTML in the cells (note only the cells that
  are identified as the 'control' cell for the column have the renderer
  applied) and apply any classes needed (thus the renderers should
  listen for the 'sort' event).

- This is done to provide integration options for other frameworks and
  advanced styling controls. For example, FontAwesome could now easily
  be used to style a header with sorting icons sourced from the font.

- jQuery UI header rendering has been seperated out into its own
  renderer which is activated by the bJQueryUI initialisation option.
  This, along with the whole of DataTables' jQuery UI ThemeRoller
  support will be moved into a plug-in in 1.11 (it is very tempting make
  that change now, but one major version for the decprecated option is
  correct I think). This is the last part of the jQuery UI integration
  that needed to be decoupled from the DataTables core - it can now all
  be provided by plug-ins.

- This fixed issue #153

- Renderers still be to documented.
2013-06-22 11:12:40 +01:00
Allan Jardine
81a76059ae Dev: Refactor _fnBuildHead to be a good deal tidier and smaller
- Saves about ~300 bytes on the min file.
2013-06-21 11:37:20 +01:00
Allan Jardine
95be4568eb New: Support for box-sizing: border-box;
- Setting `box-sizing: border-box;` for table cells would cause
  DataTables to incorrectly calculate the size of the element when
  applying the scrolling draw. This is because jQuery's $().width()
  always returns the content width (taking into account box-sizing).

- One possible fix was to detect the box model used and switch between
  width() and outerWidth(), but a much better fix is to use
  $().css('width') as this does take into account the box-model and
  allows DataTables to draw the scrolling table columns correctly,
  regardless of the box model. It should actually also improve
  performance, since jQuery doesn't need to look the box model up
  itself.

- This fixes issue #157
2013-06-21 09:45:29 +01:00
Allan Jardine
370a1e7f7a New / update: The data option, when used as a function, is given and
can return only objects now.

- The new `ajax` option for 1.10 did previously allow both arrays of
  objects with name value pairs and objects, however, this change
  removes the option of using arrays of objects to try and simplify
  things. One of the most common questions in the forums is about name
  value pair objects, so this sidesteps that.

- The big benefit of doing this is that the data passed into `data()` is
  now very easy to manipulate. Rather than needing to loop over the
  array, you can just modify the parameter you want.

- It also allows an object to be passed back from the function,
  manipulated as desired. For example it is now super easy to nest the
  DataTables parameters in a sub-object:

	$('#example').dataTable( {
		'processing': true,
		'serverSide': true,
		'ajax': {
			'url': '../server_side/scripts/server_processing.php',
			'data': function ( data ) {
				return { 'myprop': data };
			}
		}
	} );

  This fixed issue #124.

- The parameters submitted to the server and those expected back are
  currently left as is. They will be updated to be camelCase at some
  point, but not yet sure if that will be for 1.10 or 1.11.
2013-06-21 09:26:51 +01:00
Allan Jardine
76e572985d Build latest changes 2013-06-21 07:38:46 +01:00
Allan Jardine
a194116c42 Dev: Fix display class for the sort column.
- Styles weren't being correctly applied becuase the selector was
  `table.dataTable.display.stripe` rather than just
  `table.dataTable.display` for the "correction" styles when multiple
  styles are enabled.
2013-06-20 10:08:40 +01:00
Allan Jardine
bda2d25b5f Internal: Change the application of global filtering methodology
- Reducing the complexity of how the global filter is applied in
  DataTables by removing the `asDataSearch` internal settings array
  which held information about each row's filtering data. This is now
  held on a per row basis in `_sFilterRow` which is built only when the
  data is invalidated. This should result in a small performance
  improvement as well as simplifying and reducing the code.

- Filtering is now implemented by simply checking the built regex
  against the `_sFilterRow` parameter for the display array (with a
  reset to master, as there was before, if needed)

- This also fixes an indexing issue that was present in the filtering in
  1.10.dev only
2013-06-20 08:52:52 +01:00
Allan Jardine
1a880b9f46 Dev: All the latest changes now built 2013-06-19 17:34:49 +01:00
Allan Jardine
3827b96b7d New: jQuery UI integration now has the sorting_* classes applied to it
for the header cells (matching the standard case, in addition to the
ui-state-default class for styling).

- This allows the developer to add styling information based on the
  sorting state of the cell.

- This fixed issue #17
2013-06-19 17:32:24 +01:00
Allan Jardine
3d8a0d2f30 New: Add sHeaderTH class option to the classes to match the sFooterTH
option

- This fixes issue 175
2013-06-19 17:11:21 +01:00
Allan Jardine
3d1d64bc4e Dev fix: Call number formatter in the correct scope 2013-06-19 16:46:22 +01:00
Allan Jardine
0d8282c61a Dev fix: _pluck should check that what is is accessing exists
- When using _pluck with deferred rendering, there were a number of
  errors due to the nTr element being undefined (that's what deferred
  rendering is all about of course). So the logic to check that pluck
  can pluck from a source object needs ot be added.
2013-06-19 16:44:38 +01:00
Allan Jardine
0142172027 Dev fix: The sort classes were being applied regardless of sort and
`sortClasses`
2013-06-19 16:43:12 +01:00
Allan Jardine
d2755c4037 New - init option: classes option can be used to modify the classes
object

- Previously to modify the class names that DataTables uses for its
  components you has to use $.fn.dataTable.ext.oStdClasses. Now you can
  use the `classes` initialisation option which will extend the classes
  object of the DataTable.

- This fixes issue #180.
2013-06-17 12:05:07 +01:00
Allan Jardine
5cecbb5528 New: Automatic detection of HTML5 data-* attributes for orthogonal data
- Building on the new ability of DataTables to work with element
  attributes as data sources for sorting and filtering, this commit adds
  auto-detection of the attributes 'data-sort' and 'data-filter' in DOM
  sourced tables.

- The first row in the table is used for this auto-detection and the
  built mData object assigned only when it is found to be the default
  for the column (i.e. the column index). So any custom value is
  retained and thus if you want to use a custom value you need to build
  the attribute querying object manually (I think the majority of uses
  will not need this!).
2013-06-17 11:35:06 +01:00
Allan Jardine
0f2cc15217 New: HTML5 data attribute support. data-* attributes can now be used to
source orthogonal data for filtering, sorting and type detection data.

- In HTML5 the data-* attributes can be used to add semantic data to an
  HTML page, which a user will not see, but the scripts on the page can
  interact with. DataTables now has the ability to use these attributes
  (actually any attribute can be used) as a data source. Previously DOM
  sourced tables always used just the content of the cells for all data
  interaction, but this can provide advanced controls in just the same
  way that Javascript / Ajax sourced data can do orthogonal data in
  DataTables.

- A typical use case is to provide numeric sorting information for
  complex formatted dates that the browser doesn't understand with
  Date.prase().
2013-06-16 09:49:18 +01:00
Allan Jardine
b353431cbe Dev: Documentation update to indicate more clearly that dataSrc can be
used as a transform function
2013-06-16 09:48:48 +01:00
Allan Jardine
3edd19ed9d Dev: Reduce code footprint for the Ajax get function 2013-06-15 09:53:39 +01:00
Allan Jardine
11591f4894 New - CSS: Add 'display' class to the options list.
- 'display' is a short cut for using the classes: 'hover stripe
  row-border sort-column'
2013-06-15 09:22:16 +01:00