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

391 Commits

Author SHA1 Message Date
Allan Jardine
91c63b8ad5 Fix: When a previous search column details is defined for column 0, it would fail incorrectly. Now fixed 2012-01-15 10:37:43 +00:00
Allan Jardine
acec127c9a Fix: Backwards compatibly for fnGetData and fnGetNodes when the row (as an integer) is not available 2012-01-15 10:30:48 +00:00
Allan Jardine
0c3dadbed9 Fix: fnOpen - when passed a TR element (or indeed any other element) that is not part of the master table (i.e. under control of DataTables), DatTables would try to "open" the row anyway - which was wrong. So now check that the node given is a TR element under control of DataTables, otherwise silently return. This is useful for using fnOpen when bound to all TR elements in the TBODY with a live event handler (i.e the click would also occur on the opened row). 2012-01-15 10:09:06 +00:00
Allan Jardine
dbf87ff5cd Performance: MUCH faster removing of DOM elements in the header and body of the table - 8060 - performance testing: http://jsperf.com/remove-detach/11 2012-01-14 09:48:52 +00:00
Allan Jardine
1077ebcf08 Performance: there can only be 1 open row per parent TR, so quit out the loop when found - 8060 2012-01-14 09:38:19 +00:00
Allan Jardine
7f90aff469 DataTables 1.9.0.dev.3 2012-01-14 09:37:26 +00:00
Allan Jardine
517a3a3663 Updated: Minor change to fnOpen to be more flexible for jQuery input - 2488 2012-01-12 07:02:22 +00:00
Allan Jardine
b67c0969de DataTables 1.9 beta 2 :-) 2012-01-10 15:34:55 +00:00
Allan Jardine
91c8547f48 Fix: Couple of trivial optimisations for speed and size 2012-01-10 14:35:18 +00:00
Allan Jardine
cfb77fd569 Fix: Documentation for fnStateLoad 2012-01-10 14:30:00 +00:00
Allan Jardine
25d5ab4bed Fix: fnGetData returning all rows when trying to get row 0 2012-01-08 09:52:41 +00:00
Allan Jardine
7ae342dc7d Fix: Unable to set an sDom default if bJQueryUI:true is used 2012-01-07 16:58:58 +00:00
Allan Jardine
b689320911 Fix: In browsers that don't define JSON then there woudl be an error thrown 2012-01-07 13:31:57 +00:00
Allan Jardine
2f729af697 Fix: Made a mistake when updating the conditionals for fnFilter and fnGetData when considering rows. if ( 0 ) is of course false - so passing in an integer isn't valid - need to check for undefined - 7997 2012-01-07 12:55:28 +00:00
Allan Jardine
9809d71161 Dev update: Use $.extend to copy arrays and objects for the state savings, as we don't want plug-ins to be able to muck around with the DataTables internals by mistake (even with the slice, the objects in the arrays maintain their references) 2012-01-02 19:59:52 +00:00
Allan Jardine
a4c7ac222a Its 2012 now :-) 2012-01-02 10:42:43 +00:00
Allan Jardine
f702ac5648 New: Allow state loading to be cancelled from the aoStateLoadParams callbacks by returning false (matches the capabilities of the old state loading methods) 2012-01-02 10:19:19 +00:00
Allan Jardine
1bdbe86da2 New: Init option - fnStateLoad.
New: Init option - fnStateLoadParams
New: Init option - fnStateLoaded
New: Init option - fnStateSave
New: Init option - fnStateSaveParams
New: Event - stateSaveParams
New: Event - stateLoadParams
New: Event - stateLoaded
Removed: Init option - fnStateLoadCallback
Removed: Init option - fnStateSaveCallback
Updated: Documentation and code tidy up of the updated state saving methods.
2012-01-02 10:12:39 +00:00
Allan Jardine
cf12ba5ab3 Update: Initial work on updating state saving code to use objects rather than constructing a JSON string. Note that this has involved removing fnStateLoadCallback and fnStateSaveCallback which are now replaced with a much more effective setup using fnStateSaveParams, fnStateLoadParams and fnStateLoaded (blog post to come about this). Code documentation and tidy up yet required 2012-01-02 09:21:19 +00:00
Allan Jardine
6a59b64a60 Fix: The settings finder from node should really use === rather than ==... 2011-12-28 11:16:34 +00:00
Allan Jardine
aeed78a08c Updated: Remove the sanity check for cols x rows === cells - we can't get to this code anymore due to the fnSetCellData check (that throws an error first), so this is dead code. 2011-12-28 11:14:53 +00:00
Allan Jardine
cb014e81d7 New: Add unit tests for fnCreatedCell and fnCreatedRow
New: New init option fnCreatedRow - very similar to fnCreatedCell but in this case used for TR elements
Updated: fnCreatedCell now also gets the column index passed in
2011-12-28 11:12:30 +00:00
Allan Jardine
4808f0edd7 Dev update: Remove the 'row' event. On experimenting with CellCreated I've found that I'm getting around 4'500 triggers / sec with Safari 5.1, which really isn't close to fast enough (about two orders of magnitude out from what I would like) which means that a table with 2000 rows and 9 columns would see an additional overhead of about 4 seconds on initialisation - ouch!!! As such I've removed the 'row' event here and it would seriously impact larger tables. events are still extremely useful, however, I would suggest that plug-ins should use the callback arrays rather than events since it is much faster. These arrays might be developed further into DataTables' own triggering methods in future. Something to to be aware of certainly going into 1.10. 2011-12-27 19:46:43 +00:00
Allan Jardine
5a2d4f8782 New: Add "processing" event 2011-12-27 18:37:28 +00:00
Allan Jardine
8c9f0b61e8 Updated: Nearly all callbacks now use an array and fire an event using the use DataTables standard method for dealing with callbacks. row, header, footer, init and pre-draw callback have been added to this new method. Only aoStateSave does not use method yet. fnCookieCallback and fnInfoCallback will not use the new methods.
Update: fnRowCallback - no need to return the TR element - it was a fairly pointless thing to do - if you want to replace the element then you need to do it with fnDrawCallback
2011-12-27 13:02:18 +00:00
Allan Jardine
ab9138b773 Updated: Initial pass at tidying up callbacks and events in DataTables - adding _fnCallbackReg and _fnCallbackFire to provide a single point for registering and firing callbacks in a unified way. Not all callbacks yet use these methods and some callbacks need to be converted to the array method (useful for plug-in developers) 2011-12-25 07:52:51 +00:00
Allan Jardine
94542c810a New: fnRender update - data object now also contains mDataProp along with the other information from before. There is also a second parameter passed to the function - the current value of the cell (was possible to get it from the data array, but this makes life a little easier if you want to get just that, which is the most common usage here). 2011-12-23 18:31:25 +00:00
Allan Jardine
529aba4c5c Fix: Remove sorting classes from TD elements as well as TH - 7836 2011-12-23 13:26:59 +00:00
Allan Jardine
0a1a2a17dc Updated: The call to _fnFilterCustom doesn't need to check if there are filters since the loop will effectively do that anyway. 2011-12-21 09:11:12 +00:00
Allan Jardine
74f3426284 Fix: Modify the filtering such that client-side filtering is not done when server-side processing is enabled - its just a waste of time since hte server will do it all - 7825 2011-12-21 09:07:44 +00:00
Allan Jardine
3f9b7430f1 Version up to 1.9.0.dev.2
Remove the title attribute from the 2 button pagination - its totally redundant now
2011-12-20 14:48:27 +00:00
Allan Jardine
089797b3c3 DataTables 1.9 beta 1 :-) 2011-12-15 16:52:01 +00:00
Allan Jardine
35bbab90e2 Docs: oLanguage is a namespace, not a member 2011-12-15 16:37:42 +00:00
Allan Jardine
b447a0d4a9 Rolling back the change to starting that used localeCompare - it was causing incorrect sorting in IE9 (unit test failures) 2011-12-15 15:23:52 +00:00
Allan Jardine
8e224fec14 Small documentation update for fnGetNodes to suggest that $ should be used 2011-12-15 14:44:50 +00:00
Allan Jardine
fbc0877c94 @file attribute for JSDoc to version the documentation 2011-12-15 14:26:23 +00:00
Allan Jardine
82e52fdce1 JSDoc comment updates 2011-12-15 14:05:52 +00:00
Allan Jardine
771df2ac2d Updates for documentation - document oApi as required 2011-12-15 13:54:23 +00:00
Allan Jardine
e8fb40640e Make warning message smaller - too much payload for something that is virtual never seen 2011-12-15 12:55:06 +00:00
Allan Jardine
478d7f4de6 Column model should just use nulls where the defaults will override it 2011-12-15 12:45:42 +00:00
Allan Jardine
6d0d1100f2 Update documentation for column defaults name change 2011-12-15 12:43:26 +00:00
Allan Jardine
65f34e23f3 Apply default column options - the column defaults weren't actually being included, nevermind applied. Now put them in DataTable.defaults.columns and have them work! 2011-12-15 12:38:08 +00:00
Allan Jardine
91858f9e86 Updated: Modification to the way table width is handled - if the 'width' attribute is on the table tag, then we use that to size the table. This makes having a table width of 100% much easier than before. The reason we need to do this is that there just doesn't appear to be a good way to get the relative width from stylesheets across browsers. 2011-12-15 09:43:31 +00:00
Allan Jardine
8714f7cc0e Fix: fnInfoCallback was not being executed in the DataTables' instance scope 2011-12-15 08:08:41 +00:00
Allan Jardine
5a506746bb Fix: Alter how the selector for the $ API method works so that it works on the TR elements and their decendants
Update: modify the api_in_init.html example to use the $ API method
2011-12-14 17:42:25 +00:00
Allan Jardine
e1d860205b Change the defaults object from attaching to DataTable.models to just the top level DataTable as DataTable.defaults - makes it much easier to access it when trying to set a default. 2011-12-14 16:22:58 +00:00
Allan Jardine
c44e10cf98 Tidy up the settings object - a lot of the settings should have null as the default since they are set by the initialisation.
Dev fix: Filtering usig anything other thant he API would always do case-sensitive matching
Doc fix: bAutoWidth wasn't documented
2011-12-14 16:02:03 +00:00
Allan Jardine
6db08eb107 New: Filtering now has a case insenstive option - this is bCaseInsensitive in oSearch, or the 6th parameter for fnFilter 2011-12-14 15:26:37 +00:00
Allan Jardine
356579f311 Documentation - note that DataTable is not a global object, but give variables for how it can be accessed 2011-12-14 15:08:42 +00:00
Allan Jardine
bebc9e516d Documentation update for fnDrawCallback - it does actually get a parameter - the settings object 2011-12-14 14:12:48 +00:00
Allan Jardine
b235c64c2a Language options always get extended with the initalisation object now - this allows you to use both a file source and the local script if you wanted. It also allows backwards compatiablity with language files that don't have the oAria namespace. 2011-12-14 13:39:06 +00:00
Allan Jardine
27488c4093 Tidy up use of typeof and undefined in DataTables - the main goal is to reduce code size under 70K here, but its a good opertunity to get this area sorted out. Note that the unit test update for fnInitComplete is because 'json' is now always passed through, although it will be undefined in anything but Ajax sourced client-side processing. 2011-12-14 13:35:49 +00:00
Allan Jardine
1c60542040 Can't extend null on the classes - make the default an object for the settings classes holder 2011-12-14 11:59:26 +00:00
Allan Jardine
64a1b6b032 Copy the column options on top of the column settings object 2011-12-14 11:33:29 +00:00
Allan Jardine
b3e57df2ef Reduce code size slightly (not much in fairness - but every little helps...) 2011-12-14 11:27:45 +00:00
Allan Jardine
013eac9d0b Only the constructor should be referring to oJUIClasses - also in the constructor copy the class object rather than referencing 2011-12-14 11:15:17 +00:00
Allan Jardine
2bc7cd34c9 Remove redundant information in the message 2011-12-14 10:57:34 +00:00
Allan Jardine
57cc9f1b2c Small tidy up of how the column filter state is saved 2011-12-14 10:50:34 +00:00
Allan Jardine
c8c40189a2 Remove pointless duplication of code - it was doing the same thing, just with different pointers 2011-12-14 10:48:15 +00:00
Allan Jardine
169eb721d2 New: oLanguage.oAira.sSortAscending and oLanguage.oAria.sSortDescending language strings which are attached to the label for a column header when it can be sorted. Basically the same as before, but now customisable.
New: iTabIndex initialisaiton option - allow the developer to decide what tab index could be given to the table.
Reverted: Two button navigation using A tags again - important for if there is no CSS
New: ARIA supoprt for the full numebrs pagination style
Changed: Tidy up the way events are added to the pagination and headers to reduce code.
Changes: Complete ARIA support for column headers so we now consider bSortable
2011-12-14 10:38:20 +00:00
Allan Jardine
bec6085880 Update ARIA attributes based on feedback from Vinnie Young ( http://groups.google.com/group/free-aria/browse_thread/thread/96156d857f35e10d#msg_e451dd817dfe01b1 ). Label for column header now states the column title and the next sort. TBODY has a role of alert and TR elements in THEAD have a role of 'row' 2011-12-13 08:55:46 +00:00
Allan Jardine
4e8f0fadd9 _fnArrayCmp is not used anywhere these days - ditch it 2011-12-12 09:38:34 +00:00
Allan Jardine
d7d3aeddea Fixes from JSHint and JSHint configuration. Note that I'm using a slightly modified JSHint to remove checking of mixed spaces/tabs and trailing white space due to issue 21 against JSHint (https://github.com/jshint/jshint/issues/21) - specifically it objects to my comment styling for the JSDoc comments, which I've got _everywhere_! 2011-12-12 07:43:54 +00:00
Allan Jardine
88b2990e53 Correction to the last commit - check against the default parameter rather than the default value! 2011-12-11 08:52:13 +00:00
Allan Jardine
9a94759fa4 Override the default sDom when using jQuery UI 2011-12-11 08:51:03 +00:00
Allan Jardine
a41a68d91d Don't include duplicate classes - just extend the base for the jQuery UI version 2011-12-11 08:50:34 +00:00
Allan Jardine
d9e02ab5c8 Pull the Ajax functions into their own file 2011-12-11 08:44:28 +00:00
Allan Jardine
e5816e381c New: fnPageChange will now accept integers as well as the four current strings. The integer given represents the page that the table should jump to. Also update the internal calls to use this new ability as it is cleaner. 2011-12-11 08:41:55 +00:00
Allan Jardine
0d772b5eba Always add an ID to a table if it doesn't already have one
Add a class to the table to identify it as a DataTable
Update setAttribute to use id - works just as well and slightly smaller
2011-12-11 08:27:41 +00:00
Allan Jardine
d0458ca22c First effort at ARIA support - the table control widgets link themselves to the table now ('controls') and the column headers say what they do. The table is also described by the information control. Note that an ID on the table is needed for most of this, since ARIA can reiference elements. 2011-12-10 11:34:30 +00:00
Allan Jardine
8eb722271e Update the styling of the default pagination to make it more attractive. Also remove the previous change to use A tags - concerned about backwards compatibility and developers needing to update styles. Impact on accessibility to be evaluated, when ARIA button roles are added. 2011-12-10 10:33:00 +00:00
Allan Jardine
224b3b0661 Documentation changes, suggested by Michael Mathews (author of JSDoc). Generated documentation for DataTables should now be more or less complete. 2011-12-09 08:33:45 +00:00
Allan Jardine
23993219d7 Trivial change to the full numbers conditional logic. Its the same logic as before, just more sensibly laid out. 2011-12-08 11:39:51 +00:00
Allan Jardine
e2ac47b675 Had broken API extension methods... There was a bit of confusion between oApi as an internal variable and as an external variable. This commit effectively brings them together - you can access the internal functions as regular API methods now - although that might not be a particularly good idea just yet - not to be documented until I'm happy with this. 2011-12-08 10:53:22 +00:00
Allan Jardine
d4366df398 Change how the state loading callback functions operate - previously it would require that a cookie be available before the state loading callback is called. Now is state loading occurs at all the callback function will be fired - allowing easer integration with server-side state storage. I don't actually see a downside to this and it should be perfectly backwards compatible. 2011-12-08 09:51:40 +00:00
Allan Jardine
1550b37c79 Tidy up the pagination functions a bit - lass code and easier to understand 2011-12-07 18:33:59 +00:00
Allan Jardine
7a42b450db New: fnFormatNumber is now also called for the full numbers pagination elements where a number is displayed. This now means that all numbers displayed by DataTables go through fnFormatNumber - 7441 2011-12-07 11:40:37 +00:00
Allan Jardine
f535031e41 New: Use localeCompare to do string comparison, allowing much better internationlisation support for sorting strings in DataTables 2011-12-07 11:07:02 +00:00
Allan Jardine
66a2e3d659 Experiment with tabindex on the sorting headers and the pagination buttons. More to follow... 2011-12-07 10:24:03 +00:00
Allan Jardine
d210865c83 Correct link for initialisation options 2011-12-06 18:08:13 +00:00
Allan Jardine
bfd625350c One thing that has bugged me a little since I first wrote DataTables was that for some mental reason I picked $.fn.dataTable rather than $.fn.DataTable as the jQuery access function. This commit now allows either approach. 2011-12-06 18:04:57 +00:00
Allan Jardine
d8132799f7 Update internal variable names - rather than using the local private variables _aoSettings and _oExt, these are now attached to the DataTable object as static parameters. Cleaner and will document easier as well. 2011-12-06 18:03:29 +00:00
Allan Jardine
a22727c84b Remove trailing commas! 2011-12-06 16:44:17 +00:00
Allan Jardine
bccc85ef9f New: For plug-in authors, the internal function _fnApplyColumnDefs has been created and made available to make it much easier to present aoColumns and aoColumnDefs options for plug-ins (the names of the parameters can be whatever you want). Basically the function will take each of the two arrays (or null if not available) and figure out what definations should be applied to what columns - and then callback to a function that will apply the configuration (specific to the plug-in). This is now also used for the DataTables aoColumns and aoColumnDefs. 2011-12-06 16:05:53 +00:00
Allan Jardine
d6d24275df Fix: If there is an sClass defined for a column, and a footer element for the column, apply the sClass to it, just as we do to the header. 2011-12-06 15:11:14 +00:00
Allan Jardine
a264ca66e9 New: fnCreatedCell option for columns - this function is a compliment to fnRender, but in this case it is called when the cell is available (unlike fnRender). This allows DOM manipulation of the cell (or possibly the row as the parentNode if you so wished), such as adding a cell based on the cell data, or any other DOM manipulation. 2011-12-06 14:48:49 +00:00
Allan Jardine
b0d5255de9 New: $ API method for performing a jQuery selector on the TR elements in the table's body. Provide options to adjust the filtering, sorting and paging results with sensible defaults. This will make manipulating the table for styles, events etc much easier. 2011-12-06 12:09:38 +00:00
Allan Jardine
b4a289bf36 Limit the span modification for the sort classes - from pull request 40 (https://github.com/DataTables/DataTables/pull/40). 2011-12-06 11:24:35 +00:00
Allan Jardine
c6d1dfd929 New: New API method: fnIsOpen - to work with fnOpen and fnClose, allowing a quick check to see if the row is currently open or not. 2011-12-06 11:05:58 +00:00
Allan Jardine
07c3d3f5a6 New: Add an optional parameter to fnDestroy that will cause the table to be completely removed from the DOM, as well as unbinding events etc (the default is the original behaviour, which is to reinsert the table into the DOM where it was originally located) - 7523 2011-12-06 10:52:56 +00:00
Allan Jardine
77c551268e Change: Add a parseInt to the two integer values that come back from server-side processing. The question about why it doesn't work when strings are returned (or rather, why is it broken) keep cropping up in the forum. 2011-12-06 10:44:18 +00:00
Allan Jardine
5f53331cd6 New: Accessability change - use A tags rather than DIV/SPAN for the pagination buttons. This is a backwards incompatible change, but a sensible one 2011-12-06 10:39:22 +00:00
Allan Jardine
30e018f398 Fix: Cast fnFilter input to a string always - since we are always going to treat it as a string 2011-12-05 17:20:53 +00:00
Allan Jardine
2928326042 Tidy up the initialisation code a bit for creating the settings object and integrate the language compatibility fully 2011-12-05 16:36:20 +00:00
Allan Jardine
9dc702329d Fix: It appears that the latest Webkit browsers have changed their scrolling behaviour slightly, which is causing the unit tests to fail. Basically the 'scroll' event is being fired when the infinite scrolling table is having data written to it (i.e the scroll changes - so its kind of fair enough!), so add a check to only load the first set of data when there is no scrolling applied. 2011-12-05 10:00:40 +00:00
Allan Jardine
6a7a7151b8 Alter the extending of the initialisation parameter with the defaults a little such that objects are deep copied and arrays are not (code needs tidied a little - want to get it passing all unit tests first). The thing here is that we can't use jQuery's $.extend for a full deep copy since we don't want to deep copy arrays (for example aaSorting, where the default sort would always be applied), but we do want to deep copy objects (and not just take a reference to the default object). Thus we can't use $.extend :-(. 2011-12-05 09:21:20 +00:00
Allan Jardine
94539913a5 Update to jQuery 1.7.1 2011-12-05 09:20:34 +00:00
Allan Jardine
6205de54a4 Fix numeric sorting pre-formatting method typo, picked up by the unit tests 2011-12-03 09:56:46 +00:00
Allan Jardine
ee47cb7518 Add and document the extension object for DataTables. The extension object (ext) allows plug-ins to be added to DataTables (and is also used for this internally as well). 2011-12-03 09:36:19 +00:00
Allan Jardine
e5b826c434 Rearrange the 'ext' option and make the base object a model so it can be readily documented. More documentation required for the model to explain what each of the options does 2011-12-02 07:22:57 +00:00