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

597 Commits

Author SHA1 Message Date
Allan Jardine
4812d1d35b Dev: New: _DT_RowIndex is a private parameter that is attached to all TR elements in the table now. This allows fast reverse mapping from the row index to the aoData entry (typically this will be used for getting _aData). Before we would have to loop over all rows which could be very slow, but this reverse mapping allows several new options for optimisations and future enhancements.
Dev: Updated: All fnRender calls have been put into a single point - code reuse...
2012-01-20 21:48:45 +00:00
Allan Jardine
e7bba4bcbe Dev fix: The last change for fnAddData was incorrect - it would mean that objects couldn't be added... 2012-01-20 17:39:37 +00:00
Allan Jardine
139f33603a DataTables 1.9.0.dev.3
Fix: fnAddData - check for 2D array could fail on null, since null is an object type - 8134
2012-01-19 09:36:55 +00:00
Allan Jardine
1421a08b90 Reissuing 1.9.0.beta.2 - the one I tagged before was never released outside me tagging it, since there was no time to write up the release notes, and now with a few more bug fixes, I think they should be rolled into to what will be released as 1.9.0.beta.2 2012-01-15 15:59:38 +00:00
Allan Jardine
80472cdd13 Dev fix: Oops - inverted logic for column filter definitions 2012-01-15 10:45:28 +00:00
Allan Jardine
1e7f3066f9 Fix: A stored display start (iInitDisplayStart) of 0 would cause an undesired effect 2012-01-15 10:43:01 +00:00
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
Allan Jardine
e86da5d30a Only need to define oApi once... 2011-12-01 19:58:34 +00:00
Allan Jardine
c491f8a37f Add examples to API methods and tidy up the way oApi is generated a little 2011-12-01 19:47:40 +00:00
Allan Jardine
aeedb9afdc Internal and API methods now use JSDoc comments rather than my old system 2011-12-01 17:53:59 +00:00
Allan Jardine
5c67be62ae Use the oSearch model for the default initialisation and column initialisation 2011-11-27 18:51:56 +00:00
Allan Jardine
3ddd89b52e Add JSDoc comments for the DataTables settings object 2011-11-27 17:50:06 +00:00
Allan Jardine
133e7fb7fe Fix various comment spelling mistakes 2011-11-26 18:51:45 +00:00
Allan Jardine
b6e60beef5 iNextId can go the same way as _iId since that is all it was needed for 2011-11-26 14:13:50 +00:00
Allan Jardine
eb6bde7e08 Drop "_iId" from the row model - its not used anywhere in DataTables these days. An old legacy property from the 1.3 days I think - can't imagine any third party plug-ins use this property either - its more or less useless these days. 2011-11-26 14:06:55 +00:00
Allan Jardine
d5e5d31725 Document the row model and update the data methods to extend this model as the base for aoData 2011-11-26 14:04:58 +00:00
Allan Jardine
cc265bcb09 Add defaults for aDataSort and sServerMethod (the two new parameters that have been introduced since the last release) 2011-11-26 13:45:08 +00:00
Allan Jardine
dcf88a2609 Tidy up the constructor to take account of the fact that we now have every possible property in the initalisation objects, since it is being extended from the details - i.e. no need to check for 'undefined' any more. 2011-11-26 13:34:51 +00:00
Allan Jardine
d20b87f885 First pass are using $.extend for the settings and initialsation objects.
Back into a state where the zero config will work
2011-11-25 17:08:21 +00:00
Allan Jardine
626492b81c Big change to how DataTables constructed in the file system - breaking the various parts of DataTables seperate files. This is probably the biggest individual change to DataTables since it was first written, but the code itself is more or less the same - just split out into different files. The one big change to the code thus far is to change the function classSettings into an object that is extended. More work is required on this to complete the alteration, but for now DataTables is building into the same workable form as before using the new make.sh file. 2011-11-24 14:05:22 +00:00
Allan Jardine
1f02ac87fc Fix: Filtering doesn't deal with carriage returns - 6313 - thanks to Jonathan Camp for this fix. 2011-11-23 07:28:16 +00:00
Allan Jardine
2c14233057 New: Optimisation for sorting - when the sorting runs it will execute the sorting function a lot, particularly for large tables, so we want these functions to be as fast as possible. As it stood, each time the function ran it would prep the data and then do the required comparison - and it would do that data prep every time. This is pointless since toLowerCase (for example) is always going to give the same result when using the same input - so now introduced a third sorting function type (in addition to 'asc' and 'desc') called 'pre', which will pre-format the data to be sorted, only once for each item to be sorted, allowing the sorting comparison function itself to be really fast (simply just the comparison). This is also backwards compatible, if the sorting type doesn't have a 'pre'-formatting method then it will just use the two sorting functions as normal. 2011-11-19 09:53:11 +00:00
Allan Jardine
a1b33880c6 New: aDataSort parameter for columns - this allows a column's sorting to take multiple columns into account when doing a sort. For example first name / last name columns make sense to do a multi-column sort. Previously in DataTables you would need to have the user do a multi-column sort themselves (with shift), but now you can define aDataSort (for example aDataSort: [ 0, 1 ]) to do effectively a multi column sort. Note that this is not shown to the end user that this was a multi-column sort in the same way that iDataSort wouldn't indicate that it could sort on a different column (if that was configured). Also note that iDataSort is still available for use and has not been modified externally, but if aDataSort is defined it will be given priority over any iDataSort parameter. 2011-11-18 16:21:44 +00:00
Allan Jardine
967e1419c1 Modified: The 'i' counter that was in the sort loop was outside the function scope, so the JS engine would need to go back up a level in its scope chain. Not a big thing, but any speed in the sorting function is welcome 2011-11-18 16:01:43 +00:00
Allan Jardine
4c48650a25 New: Pass the cell read 'specific' type to mDataProp if it is given as a function. This might seem like a really simple change, but it greatly expands the flexibility of DataTables. It means that for a column, if you define this function and switch between the four 'get' data types for the cell ('display', 'type', 'filter' or 'sort') you can use different data for each one. So for example you could display a formatted number but do sorting on the numeric version of the number, and filtering on both types (so the user can type either version). The "type" option is for DataTables' type detection. Most of the framework for this was in 1.8.0 - I had thought to include options such as mFilterData (and might in future), but this is the first step to do that without introducing much overhead. 2011-11-14 08:34:29 +00:00
Allan Jardine
30a437d80e Fix: fnUpdate recursion would cause an error if dealing with nested arrays - 7292. Fix is to let the function know, with a private variable, that it is being called recursively. 2011-11-10 08:15:03 +00:00
Allan Jardine
42567c9968 New: New API method '$' which will perform a jQuery selector action on the TR elements from the table's TBODY, regardless of paging. For example: oTable.$('#allan').css('background-color', 'red') will find the element (TR, TD or anything else) which has an ID of 'allan' and perform the css action on it. This is potentially a much nicer interface than needing to use fnGetNodes. Still more to be done, such as options to take column visibility, ordering and filtering into account, but this might be the tipping point for calling it 1.9 :-) 2011-11-09 08:58:24 +00:00
Allan Jardine
58f85fc601 New: Add "sServerMethod" initialisation option to make it easy to change from GET to POST for server-side requests. Needing to supply a custom fnServerData just to get POST was a bit of a pain - this is now no longer needed. In theory fnServerData should generally not be needed now (with fnServerParams, mDataProp and this new parameter making set up much more flexible). 2011-11-09 08:50:30 +00:00
Morten Brix Pedersen
5732f4c1fa Fix typo 'destory' -> 'destroy'. 2011-11-07 09:55:01 +01:00
Allan Jardine
f46a49f7f4 Updated: jQuery 1.7 time - DataTables passing all unit tests with the new jQuery 2011-11-04 19:46:41 +00:00
Allan Jardine
49a2c1d427 Merge pull request #32 from ghostd/master
fnDestroy does not remove all jQuery UI markup
2011-10-15 11:17:44 -07:00
Allan Jardine
b68073b911 Dev change: Slight modification of the code for getting the Ajax source property for Ajax sourced data and server-side processing to save a few more bytes :-) 2011-10-15 09:04:48 +01:00
Allan Jardine
1ae7f81a11 Dev update: Slight modification of style for the inner functions in the pagination controls 2011-10-15 09:01:27 +01:00
Allan Jardine
841480fa59 Merge pull request #34 from thegrandpoobah/pagination_events
Apply some DRY to pagination extension code
2011-10-15 00:32:31 -07:00
Sahab Yazdani
4b1b4626a5 Same thing for two button pagination control 2011-10-14 15:13:13 -04:00
Sahab Yazdani
ba02adc6e9 DRY for the four event handlers 2011-10-14 14:47:20 -04:00
Vincent Ricard
1d8deed379 fix DataTables #30 2011-10-10 14:23:34 +02:00
Allan Jardine
f9f6031321 Fix: Function name in comment for fnSetColumnVis was wrong 2011-10-08 20:09:03 +01:00
Allan Jardine
f175f3658e Fix: Calculating the width of a table can be incorrect when the calculation table is hidden due to an issue with jQuery's
width/outerWidth calculation (http://bugs.jquery.com/ticket/9945). This is a bit of a work around to get the css value and check if it is
a percentage - this is not perfect (since other relative values aren't checked - although they are generally unlikely to be used), but it
is effective for most cases.
2011-09-16 08:45:00 +01:00
Allan Jardine
437ac29048 DataTables 1.8.2 :-) 2011-09-10 10:35:54 +01:00
Allan Jardine
5f82b240bc New: If a data source is found to be a function, then the function is executed and the return used for the cell display (+sorting, filtering etc). This is useful for integration with knockout.js and backbone.js etc. 2011-09-10 09:12:23 +01:00
Allan Jardine
e32312be0b Dev fix: The new custom events will always pass the DataTables settings object as the first parameter 2011-09-10 08:05:51 +01:00
Allan Jardine
22cb3edef7 Update to latest jQuery - 1.6.3 2011-09-10 08:00:39 +01:00
Allan Jardine
8a8ca1e7b8 New - experimental: Add custom events into DataTables - the events available are "draw", "filter", "sort", "page" and "xhr". These are very useful for knowing when these actions happen and binding an action to them. Useful for plugin developers and developers using DataTables both. Note that it would be possible to put in a _LOT_ more custom events ("predraw" etc) which is why this feature is currently considered experimental. It will not be documented in the DataTables documentation until this has stabilised (likely 1.9 or 2.0) and a scheme has been fully confirmed for these events, but I want to include them now to see if and how they are used by developers to see them or talk to me (as this has been asked for a few times). I'm also slightly concerned about the overhead that would be generated if there were custom events for everything. 2011-09-10 07:59:44 +01:00
Allan Jardine
31ccd959bc Dev fix: Remove the UTF8 BOM which had somehow found its way in. No need for it here and it was upsetting JSLint... 2011-09-09 19:39:21 +01:00
Allan Jardine
5131e1dd7f Fix: HTML column type could sometimes be overridden by the string sorting type. If a cell was found to have just a string and no HTML in it then the whole column would be treated as a string column, even if other cells had HTML. Now put a check in place to ensure that string can't overrule html type. Unit test added. 2011-09-09 19:32:59 +01:00
Allan Jardine
856bef205d Fix: In webkit browsers the cursor in the active filter would always jump to the end of the input string due to an incorrectly matching elements (after the introduction of the label tag for the filter). Use a jQuery selector to make this more robust. 2011-09-09 09:06:50 +01:00
Allan Jardine
4c501bd2d8 Dev fix: Can't use '>' in the children() method for jQuery since it would try to match on the wrong elements. Need to add another 'children' call. 2011-09-09 08:44:52 +01:00
Allan Jardine
826545f1e5 Dev fix: Mistake with the legacy support for asStripClasses and its typo change to asStripeClasses. Would never accept the old spelling. 2011-09-08 17:47:55 +01:00
Allan Jardine
8fd5311d9e Fix: Due to the jQuery $('>...') selector syntax being deprecated, change the format to use the 'children' option instead 2011-09-08 17:39:24 +01:00
Allan Jardine
ad104832d8 Fix: Nested tables in the the main table's header wold cause an error due to too many TR elements being selected by the header detection method. We want to pick up only the child elements of the header - 6485 2011-09-08 17:12:23 +01:00
Allan Jardine
9f171bbd7e Fix: Backwards compatibility for the init parameter asStripClasses with the spelling correction to asStripeClasses. asStripeClasses should now be used, but asStripClasses can be used. If both are given, the newer one will be used in preference to asStripClasses. 2011-09-04 10:04:46 +01:00
Keith C. Ivey
505335b796 correct "stripe" spelling 2011-09-02 11:33:10 -04:00
Allan Jardine
0c296ca76e New: fnServerParams callback function - this allows additional parameters to be added to the XHR for server-side processing or Ajax sourced, client-side processed data, with ease. Previously it was required to override the fnServerData method just to add a couple of parameters, but the built in fnServerData method is quite comperhensive and you don't want to have to reproduce all of that unless you need to. Now you don't need to :-). fnServerParams is called on each request, so it is ideal for adding extra parameters such as search parameters which can be updated by users. 2011-09-02 16:01:56 +01:00
Allan Jardine
4708870aa0 Changed: Use $.extend for the language options - its quicker and easier! The init options should be done like this as well, but that will likely be 2.0 due to the way it is currently implemented... 2011-08-30 18:27:12 +01:00
Allan Jardine
e87798781b New: Add a thousands seperator option to the language options. As a displayed string in DataTables this should be configurable, and now is with the oLanguage.sInfoThousands options ( "oLanguage": { "sInfoThousands": "'" } for example). 2011-08-30 18:20:59 +01:00
Allan Jardine
b93d6bc243 Update to latest jQuery - 1.6.2 2011-08-30 18:20:21 +01:00
Allan Jardine
deae02b9d0 Fix: Array detection for input data was dodgy - an object with a paramater that has a name of 'length' would mess things up - 6271 2011-08-23 21:52:32 +01:00
Allan Jardine
6dc4630866 Fix: Table width issues with y-scrolling enabled. Some of the caluclations which were introduced into 1.8.1 to stop the table getting smaller than it can be were wrong under certain conditions. This changes should address this but further testing is required due to the number of variations.
Fix: IE6/7 when y-scrolling was filtered to a list without y-scrolling would lose the width of the scrollbar (i.e. not expand to fill the empty space). The IE6/7 specific calcuation needs to be done only when the element is overflowing.
2011-08-14 15:00:10 +01:00
Allan Jardine
8a7c5c938e Fix: Don't rebuild the client-side search array when using server-side processing since it isn't used! - 5742 2011-08-13 12:40:08 +01:00
Allan Jardine
9a1fddf79b Fix: Fix typo in internal variable name - "asDestoryStrips" should have been "asDestroyStrips" 2011-08-13 08:30:22 +01:00
Allan Jardine
88932adb92 Fix: The scrollbar width calculation could sometimes be wrong when trying to calculate the size of the bar due to CSS styles. The inner P element could be given padding for example which would result in the scrollbar width being wrong and thus any calculations later on witht he scrollbar width would be incorrect. 2011-08-07 14:57:06 +01:00
Allan Jardine
93afeb100f Fix: IE7 doesn't like setAttribute('rowspan') (and colspan) so we need to do it the old fashioned way... - 6012 2011-08-03 20:01:08 +01:00
Allan Jardine
0843c71f7d Fix: typeof null is an object, which causes issues in fnUpdate when checking if a value passed in is an object or not to fail if null is given as the value. Need to check for null values - 5987 2011-08-02 06:52:20 +01:00
Allan Jardine
1bf42d2ca9 Fix: Add a method for plug-ins to have a destructor for when DataTables is destroyed - allowing clean up of events and anything else the plug-in has done. Plug-ins should add an object to aoDestroyCallback with 'sName' (to identify the plug-in) and 'fn' as the plug-ins destroy function. 2011-07-13 21:05:02 +01:00
Allan Jardine
61f05f8da7 Fix: When applying the sanity width for y-scrolling only we need to know if the scrolling element has scroll bars visible or not. Previously we checked if the element was bigger than the visible area, but this isn't good enough of overflow:scroll is set. Need to check that parameter as well - 5658 2011-07-08 17:27:35 +01:00
Sahab Yazdani
2995d43da4 one more 2011-06-30 16:34:18 -04:00
Sahab Yazdani
f9f5743665 more spelling fixes 2011-06-30 16:23:27 -04:00
Allan Jardine
98737aaeb7 Fix: More adjust typos! 2011-06-30 19:35:42 +01:00
Allan Jardine
0e46abde6c Correct spelling for the internal function _fnAdjustColumnSizing (was _fnAjustColumnSizing) - from pull request 11. 2011-06-30 18:34:26 +01:00
Allan Jardine
2c9ce2aa59 Fix: When filtering is applied to a table which has y-scrolling, and the filter was sufficient to make the scrolling disappear, the table width would increase by the scrollbar width. This was of course incorrect and the result of a change for 1.8.1 - we need to test is the scrollbar is present or not for the fix to be correct, which it now does. Unit test added.
Fix: As with the fix in 1.8.1 for the x-scrolling appearing when disabled the footer needs the same consideration as the header, otherwise it can be cut off visually.
2011-06-29 18:08:14 +01:00
Allan Jardine
2db0cb398f Start 1.8.2 development
Updated: Split the Ajax parameter building into it's own function (_fnAjaxParameters) so it can be called through the oApi parameter. The intention is that external programs such as TableTools can build up the same parameter set as TableTools uses.
2011-06-27 17:25:52 +01:00
Allan Jardine
f7c7751b4b DataTables 1.8.1 development finished 2011-06-25 19:56:53 +01:00
Allan Jardine
56a7564ee8 Dev fix: fnDestry wasn't reapplying original with correctly due to a mistake in an earlier commit - picked up by unit tests 2011-06-25 17:43:47 +01:00
Allan Jardine
3a63638916 Fix: Row alignment with x-scrolling disabled and the table too small to draw fully. Previously DataTables would emit an error about the columns not aligning in this case, and then try its best to draw the table, but this would end up looking quite bad. The fix is to not allow the table to draw smaller than it can possibly be when x-scrolling is disabled. This effects dynamically resizable tables - 5232 2011-06-25 15:29:07 +01:00
Allan Jardine
a3718fa6a9 New: Send mDataProp to the server for server-side processing. This is very simialr to the sNames parameter, but more convient when already using mDataProp 2011-06-25 08:33:06 +01:00
Allan Jardine
e00e6d39e3 Updated: Update to latest jQuery - 1.6.1 2011-06-25 07:54:38 +01:00
Allan Jardine
41bf4e28bd Fix: Columns which are sortable but hidden have events attached to them for sorting, but this event handler is not removed when the column is made visible again for fnDestroy. Simply need to change the order of how the destroy is done - i.e. remove events just after the columns are made visible, not before - 5497 2011-06-25 07:40:30 +01:00
Allan Jardine
d21a8529ee Fix: When complex expressions are built up with aoColumnDefs, resulting in the ability for a column to be turned "on and off" during initialisation, it would result in the column classes possibly not being correct for the sorting - 5472 - kudos to rups for this fix 2011-06-23 18:42:40 +01:00
Allan Jardine
c14169903f New: Accessability features - the length changing control and filtering control are now wrapped in <label> tags (an explicit relationship to their input elements) to aid accessability. You can see this immediately by simply clicking on the "Search:" text now - it will focus the input of the text box, while for screen readers it will give the label text from the label.
New: The filtering input language string (oLanguage.sSearch) now has the "macro" _INPUT_ in it to allow the input element to be positioned anywhere in the string. For example if you gave "sSearch": "Data_INPUT_Tables" the output for the filter would be "Data<input.../>Tables". This is optional - if _INPUT_ is not given, then as before will will tack the input element on to the end of the given (or default) text string.
2011-06-21 21:48:28 +01:00
Allan Jardine
aaf9697bd6 Fix: The ability to use complex data structures in 1.8 means that arrays which are passed into to fnUpdate need not strictly be the same length as the number of columns in the table - therefore the warning that is given if you do this is wrong... no other code changes needed - just no need to generate the warning! Unit test added - 5396 2011-06-21 18:38:00 +01:00
Allan Jardine
6557642f75 Fix: The table width is not set when auto width is disabled so we should not set it when destroying the table - 5220 2011-06-20 18:08:10 +01:00
Allan Jardine
3f04293609 Start DataTables 1.8.1 development 2011-06-20 18:05:29 +01:00
Allan Jardine
5574025364 DataTables 1.8.0 :-) 2011-06-04 07:38:39 +01:00
Allan Jardine
8859dfe380 New: mDataProp can now be a function as well as either a string or an
integer. This allows dynamic reading of information from the source
object (for example getting the length of an array in the data source
object) as well as the deep object reading and array index reading
already available. The function is called with a single argument (the
data object) when being read and two arguments (the data object, new
value) when being set. This can be seen as an alternative to fnRender
but it makes sense to include this functionality here as an option.
2011-05-30 14:24:57 +01:00
Allan Jardine
2530ea1fdc DataTables 1.8 beta 4 development complete 2011-05-29 19:36:42 +01:00
Allan Jardine
e9afa984d4 Fix: When using server-side processing the new sLoadingRecords message is not used since the draw doesn't progress that far. As a result the same issue as was fixed in commit cc1908baaf could occur and needs to be addressed here by checking for server-side processing. Regression picked up by unit tests 2011-05-28 11:17:31 +01:00
Allan Jardine
e769731746 Fix: Treat null the same as an empty string for type detection - i.e. don't try to detect a type on it. Regression picked up by unit tests 2011-05-28 11:06:38 +01:00
Allan Jardine
53908784fe Fix: Couple of little jslint found issues 2011-05-28 10:27:39 +01:00
Allan Jardine
cc1908baaf Fix: The check against sAjaxSource for the 'loading...' message should be null rather than an empty string since null is the default for sAjaxSource. This error would result in the loading message being shown if the table has no results initially 2011-05-27 19:20:01 +01:00
Allan Jardine
e6248382c6 Merge branch 'master' of github.com:DataTables/DataTables 2011-05-27 19:07:34 +01:00
Allan Jardine
2a9068fead New: The object returned by $.ajax is assigned to jqXHR in the table's settings object now. This means that you can access the XHR in fnDrawCallback (or any of the other callback functions, or anything with access to the settings object!) to do further data manipulation if you wish. 2011-05-27 19:05:35 +01:00
Allan Jardine
42e50f6ba7 Fix: The return false in the click handler for the full numbers pagination numbers was somewhat too harsh and stopped other
events from being attached to those elements if the developer wanted. Just use preventDefault instead - 5105
2011-05-26 10:48:13 +01:00
Allan Jardine
2eacc63f87 Fix: If there was a nested table in the thead of our target table, then the getElementsByTagName was getting the wrong element - so use a more specific jQuery selector. 2011-05-19 18:58:32 +01:00
Allan Jardine
55c4e0ac9c Fix: Oops - Committed debug by mistake. Remove... 2011-05-18 22:16:28 +01:00
Allan Jardine
5ca44c8405 Fix: The automatic type detection algorithim can incorrect give precidence to numeric sorting when an empty cell is found. This means that a column of dates with a single empty cell would be sorted as a string. The fix is to skip type detection on empty cells. This also means that the sorting algorithim needs to be updated since sType might not be defined for a column when it is sorted on now (if the data in the column is empty).
Fix: iDataSort, sDataType in the sort function should be declared as local parameters - should give a tiny bit more speed to the sort
2011-05-17 21:20:59 +01:00
Allan Jardine
12bbdad059 DataTables 1.8 beta 4 development starting point
Fix: If state saving is enabled, but sorting is not - then any saved filter would not be automatically applied. The fix is to call the filtering function at start up. Thanks to Michael Hamann and Roland Ramthun for finding and fixing this issue.
2011-05-15 18:03:21 +01:00
Allan Jardine
419ad58d0b DataTables 1.8 beta 3 2011-05-14 10:58:24 +01:00
Allan Jardine
7bef3d19b4 Fix: Tidy up the fnGetPosition API method and allow it to cope with getting a TH cell's position in the table as well as TR and TD elements. The input and output options for the function have not changed - just it's internal operation. 2011-05-14 10:48:14 +01:00
Allan Jardine
c56c84683c New: fnUpdate has been updated (oh the irony) to accept either an individual value, an array or an object as the first parameter passed to it. The individual and array options behave exactly as they did before this change - the new option is the object being passed in. This allows fnupdate to be given a data object which is identical to data objects used by the table when using complex objects and mDataProp. How fnUpdate itself actually operates has also changed to be self calling, which makes the multipe column updates for arrays and objects much easier.
Fix: fnUpdate now works with TH elements in the body as well as TD elements
2011-05-14 10:35:57 +01:00
Allan Jardine
8eafb87f1e New: New callback function fnPreDrawCallback which is called at the very start of each table draw (so rather like fnDrawCallback, just before the
draw!). This function is, like all other DataTables callbacks, execuated with the DataTables instance scope, and also takes a single parameter -
the DataTables settings object. The attached function can cancel the draw by returning false, anyother return (including undefined) results in the
full draw occuring).
2011-05-13 10:27:15 +01:00
Allan Jardine
a84eec581b New: New language option sLoadingRecords which is used when the table's data is Ajax sourced, and at the first draw only. This provides an
indication that the data is currently being sourced from the server (i.e. Loading...) rather than showing 'No data available in table' - which is
not particularly friendly. Note that for server-side processing, DataTables will leave whatever is in TBODY when it makes the first Ajax request,
so with server-side processing you would need to put in a TR/TD into the static HTML table.
2011-05-13 10:19:29 +01:00
Allan Jardine
9cf1ff785e Dev fix: The insertBefore for column visibility was incorrect if the next column was hidden as well. Need to 'fast-forward' to the next visible column to get the insert point. 2011-05-13 06:38:56 +01:00
Allan Jardine
844bbaf4ee Fix: fnSetColumnVis didn't cope with TH elements in the body due to the use of a 'td' selector. The fix for this is to use _fnGetTdNodes() (since that can get an array of TD|TH nodes, which in turn allows a nice tidy up of the insert part of the function. 2011-05-12 21:34:48 +01:00
Allan Jardine
f27c487862 Fix: fnSetColumnVis was broken when used with deferred rendering due to the offset calculation done with the huge flat array of TD nodes. The fix is to simplify this somewhat and get an array for each row (when it is available) and process that using the optional parameter for _fnGetTdNodes. This doesn't result any any extra computation time, other than the addional time to call the function (but not to execute it), since it is just moving where the loop is. 2011-05-12 20:46:33 +01:00
Allan Jardine
97386476c8 Fix: A couple of little jslint tidy ups 2011-05-12 20:37:35 +01:00
Allan Jardine
99b674def8 Fix: New algorithim for calculating the column widths for a table when x-scrolling is enabled. Basically browsers need a bit of a hand when a width is assigned to any columns when x-scrolling as they tend to collapse the table to the min-width, even if we sent the column widths. So we need to keep track of what the table width should be by summing the user given values, and the automatic values 2011-05-12 20:32:18 +01:00
Allan Jardine
84a1940cad Fix: Passing an integer for sWidth would cause the column width calculations to go completely off since they weren't actually used by the browser. Make use of the _fnStringToCss helper function for exactly this kind of thing. 2011-05-12 20:29:24 +01:00
Allan Jardine
0c493b6789 New: New column option - sContentPadding. What this option does is tag on an extra string to the content of the columns in the width calculation table, in order to take account of the fact that 'iii' is actually less wide than 'mm', but DataTables will pick 'iii' as the longer due to the string width. With sContentPadding you can add an extra string to any column to force DataTables to take account of this during the width calculation - the string in sContentPadding is not used anywhere else and is empty by default. This option will remain undocumented for the moment, since I suspect it will confuse more than help, but it is very useful to have around when x-scrolling. 2011-05-12 20:23:40 +01:00
Allan Jardine
fcc41bc535 Fix: When calculating the string width for column sizes, we know that we are going to be using strings for the display - so cast as a string, which means that we can take the length of any primitive (particularly numbers).
Fix: The max string width calculation was including HTML, which is just plain wrong since the HTML will be hidden. This is still not perfect since "iiii" takes less space than "mmm" in the browser display, but addressing that would take some serious clocks cycles, and this is good enough for now.
2011-05-12 20:18:48 +01:00
Allan Jardine
dd0e4023f0 Fix: _fnGetTdNodes works on a column data array basis, not visible columns, so _fnGetWidestNode need only deal with column indexes. It was possible before that the width calculation would be done in the wrong column if using hidden columns 2011-05-12 20:14:29 +01:00
Allan Jardine
c8c10d1fba Fix: fnGetData should give the original data object, rather than the array that DataTables uses for rendering the actual table. This was part of the original commit for the 1.8 object handling, but in retrospect, the original data is much more useful. 2011-05-12 20:11:11 +01:00
Allan Jardine
b3f5ddaf96 Fix: When calculating the column widths, we should get the data to display, otherwise a null element (particularly when using a null mDataProp) can
cause issues with columns being skipped (due to the null return)
2011-05-11 08:53:33 +01:00
Allan Jardine
275c7520db Fix: When using fnRender with a null mDataProp, although the rendering function was called, it wasn't actually saved anywhere. This meant that when the cell was actually created and the data source attempted to be read, the rendered string wasn't available - thus you got an empty cell (4943). This fix is to add a condition to the rendering call to delay until the node is created. Note that there is still a quirk here, in that the rendered data cannot be used for sorting or filtering, since again it isn't stored anywhere when the data source is null. 2011-05-10 06:38:17 +01:00
Allan Jardine
3464502c06 New: sDefaultContent property for aoColumns / aoColumDefs. This new property allows a default value to be given for a column's data, and will be used whenever a null data source is encountered (this can be because mDataProp is set to null, or because the data source itself is null). In addition to this, when set if the mDataProp value is undefined, the default will be used instead (and no error given). If sDefaultContent is not set (default is null), and the mDataProp value is undefined, an error will be given as it currently is. 2011-05-09 19:07:16 +01:00
Allan Jardine
341f6784f6 Fix: null data should be returned as an empty string for HTML display 2011-05-09 18:24:23 +01:00
Allan Jardine
d242d9cad4 Dev fix: The last commit for fnUpdate wasn't quite complete - this commit is the correct one. Updating fnUpdate to be able to cope with bDeferRender 2011-05-09 18:06:52 +01:00
Allan Jardine
d073e36c34 Fix: fnUpdate needs to consider null nTr rows for deferred rendering 2011-05-09 17:53:06 +01:00
Allan Jardine
c125efebc9 Fix: When using bDeferRender HTML in the target cell would be used as text rather than HTML when doing the width calculations - making them completely wrong - 4879 2011-05-09 17:47:18 +01:00
Allan Jardine
c8572df07a Start 1.8 beta 3 development
Backwards compatibility change: Use the get data function to cast data as a string when being used for display
2011-05-09 07:19:54 +01:00
Allan Jardine
c5b085091b DataTables 1.8 beta 2 release 2011-05-08 18:59:09 +01:00
Allan Jardine
04aa89337b Dev fix: Tidy up modifications to the _fnGetTdNodes function 2011-05-08 18:40:02 +01:00
Allan Jardine
1d651f68a3 Fix: The change in commit 537e3e9595 (537e3e9595 ) was incorrect - the column widths should be calculated with width() rather than outerWidth(). This can be seen by the misalignment in the tmp table if it is made visible. 2011-05-08 15:40:03 +01:00
Allan Jardine
2c2a4754d9 New: Add paginate_button_disabled to buttons which cannot be clicked on in full_buttons pagination, when not using jQuery UI themeing to make styling easier 2011-05-08 11:25:28 +01:00
Allan Jardine
4eb344cc1a Fix: When calculating the width for tables, need to consider TH elements as well as TD in the body. Also correctly consider complex headers 2011-05-08 07:51:36 +01:00
Allan Jardine
96d0b163ce Fix: When a column of only TH elements is used in the table it would cause indexing problems for the width calculation due to a getElementsByTagName('td'). Now use the _fnGetTdNodes (slightly modified) to do this. 2011-05-07 10:37:22 +01:00
Allan Jardine
e4390f8b00 Fix: When defered rendering was on and sort classes off, the header sorting classes weren't being appled - 4927 2011-05-07 09:36:04 +01:00
Allan Jardine
b52665fd6b Fix: Allow non string and numeric data types in the data source (including null and boolean etc). Add suitable unit tests to sanity check this. 2011-05-04 19:21:41 +01:00
Allan Jardine
06d1802874 New: Support TH elements in the table's TBODY. TH elements are now treated just like TDs in the body. This will work only with DOM sourced data out of the box - any body cell elements that DataTables creates are still TD. 2011-05-04 18:30:44 +01:00
Allan Jardine
d4b8495378 Fix: The construct <tfoot><tr></tr></tfoot> would break the new table header/footer draw. While strictly this isn't valid HTML, 1.7 and before allowed it - so adding a condtion here to allow it in 1.8 as well 2011-05-03 17:40:42 +01:00
Allan Jardine
2c8868dd53 Update version number to 1.8.0.dev.2 for beta 2 development work
Fix: Call fnRender only once when using using bUseRendered (don't need to call it twice since our internal data cache already has the rendered value stored) sin
ce this can cause some confusion with re-writing the data source value - 4871
2011-05-02 22:32:54 +01:00
Allan Jardine
fa364b57d5 DataTables 1.8 beta 1 2011-04-27 22:05:57 +01:00
Allan Jardine
ee3a7a6b89 Dev update: Remove dead code 2011-04-27 21:50:45 +01:00
Allan Jardine
f3bd978b8f Dev fix: Clean up the calls to _fnDrawHead 2011-04-27 19:18:08 +01:00
Allan Jardine
e8e30c35e0 Dev change: Put nTf back into aoColumns - it's actually quite useful! It is not maniditory that there need be a cell for every column however - the footer is a lot more relaxed than the header 2011-04-27 18:06:29 +01:00
Allan Jardine
198222d8d6 Dev fix: Read row ID/class from _aData 2011-04-23 11:44:09 +01:00
Allan Jardine
e2f31c5a13 Dev update: Automatic additio of ID and class should be done in the create TR mthod 2011-04-23 11:39:18 +01:00
Allan Jardine
e9adba0802 Dev change: mDataSource renames to mDataProp. Reason for the change is that in future we could have mSortProp and mFilterProp if we wanted to sort / filter on something other than the main data. Also we are refering to a property of the source object (or an index of the source array - hence keeping the 'm' prefix) 2011-04-23 10:38:00 +01:00
Allan Jardine
707953a285 Fix: fnDestory would put the table back into the DOM in the wrong place if the table wasn't the the only (or last) element in the parent (i.e. it was just doing an append) - 4751 2011-04-23 08:58:58 +01:00
Allan Jardine
8481826407 Fix: Sort wrapper on the header wasn't being removed on fnDestroy - 4617
New: Span elements in the header when using JUI themes, now have the class of DataTables_sort_icon applied to them automatically
2011-04-23 08:40:34 +01:00
Allan Jardine
71188b18a0 New: fnOpen will now take either a node, a jQuery object or a string (which was previously the only option) as it's second parameter, for what to enter into the 'details' row that is created - 2488. 2011-04-23 06:44:05 +01:00
Allan Jardine
503c3cfca5 New: Add unit tests for deferred loading with server-side processing
Remove: Deferred loading for Ajax sourced data - was incomplete and would be messy to fully implement
2011-04-22 23:14:20 +01:00
Allan Jardine
f39dadda62 Dev fix: JSLint tidy up 2011-04-22 22:39:47 +01:00
Allan Jardine
76390cdad2 Comment updates 2011-04-22 22:12:55 +01:00
Allan Jardine
dbc8046e6b New: Creation of TR/TD elements when using an Ajax or JS source for the table can be defered until draw time, when the rows are actually needed now - 4739. This is enabled by setting bDeferRender to true at initialisation time. It provides major benefits for speed in IE when dealing with large tables. However do note that if you are using fnGetNodes() with this enabled, then you will only get nodes which have been rendered.
New: Unit tests for delayed rendering. Now up to 2500+ unit tests :-)
2011-04-22 19:51:06 +01:00
Allan Jardine
2d0aff2b39 New: The ability to customise the property that is read when obtaining Ajax information from the server, for the data to insert into the table. The new initailisation parameter is sAjaxDataProp. It can be used with Ajax sourced data or server-side processing. When Ajax sourced data is used, it can be an empty string in which case it is assumed that an array has been passed into DataTables directly. Note also that it uses the same object data processor as mDataSource, so you can use dot notation to read from nested information (e.g. 'my.data'). 2011-04-21 18:37:36 +01:00
Allan Jardine
1277cfece9 Fix: Column defs with a string would incorrectly match on a substring class - 4793 2011-04-21 16:45:39 +01:00
Allan Jardine
7c4958ee60 New: fnGetData now has a second parameter (optionally) to get the column data used by DataTables based on mDataSource 2011-04-20 18:55:21 +01:00
Allan Jardine
f172ef5383 New: Significant change to how data is handled by DataTables. DataTables now has the ability to deal with complex objects as data sourced, which is particularly useful for dealing with Ajax data, and other data which doesn't belong in the visible table (db IDs for example). See the examples/ajax/ files that are in this commit for examples on how this works. More unit tests and further tidy up to come. Detailed examples will also be added in future - the current examples are mainly for testing 2011-04-19 19:35:33 +01:00
Allan Jardine
2d253df1e5 Dev fix: Commited debug statements by mistake... 2011-04-12 21:08:13 +01:00
Allan Jardine
b2d528d0d8 Dev fix: Hidden columns could break width calculations - unit test found 2011-04-12 21:05:25 +01:00
Allan Jardine
a5bba04353 Updated: Add support for the complex headers with a scrolling table 2011-04-12 20:57:08 +01:00
Allan Jardine
6a9e32486f New: Complex headers will now work as would be expected when giving a custom width (sWidth) to a specific column.
Fix: $().empty() removes events was well as removing the child elements, so it was removing the sorting events when drawing the header. Now just manually remove them using DOM - was introduced in the last commit
2011-04-12 19:36:07 +01:00
Allan Jardine
e290f76496 New: Column visibilty will now work great with rowspan / colspan in the header and footer! The way this is done is by creating a stored grid of the header/footer information - a grid of rows x columns - which contains information about the cell that should be at each point - regardless of rowspan / colspan. From that information it is then possible to draw the header / footer, minus any column (or row, although that is not used here) as needed. The initialisation and column visibility functions have been updated to account for this. This allows ColVis and the other plug-ins to 'just work' with complex headers.
New: Initialisation parameter: bSortCellsTop. This parameter allows control over whether DataTables should use the top (true) unique cell that is found for a single column, or the bottom (false - default). This is useful when using complex headers.
Removed: From the column definiations array (aoColumns) there is now no longer any need for anThExtra, anTfExtra or nTf. These have now been removed and will cause compatibilty issues for any plug-ins which use them.
Fix: Tidy up spaces where there should be tabs
2011-04-10 19:15:09 +01:00
Allan Jardine
a0967b7b14 Fix: State saving when using in combination with Ajax sourced data, wasn't restoring the paging state - 4490 2011-03-23 19:50:13 +00:00
Allan Jardine
15c7628d1c New: Extend the new defered loading option to consider Ajax sourced data without server-side processing. 2011-03-17 19:00:57 +00:00
Allan Jardine
7138587212 Fix: When using infinite scrolling and state saving, the saving of the draw start point is wrong, resulting in missed rows. When inifinite scrolling is enabled the state should be saved as starting at 0 always. Thanks to Jan (di4bl0s) for picking this up - 4388 2011-03-12 07:02:59 +00:00
Allan Jardine
501324a590 Fix: Commit c01dda2a60 introduced a global variable to DataTables in fnGetData and fnGetNodes. This commit fixes that while keeping the introduced feature. 2011-03-08 19:29:38 +00:00
Allan Jardine
789a6876f0 Fix: Small typo in deferred variable comment 2011-03-06 14:58:53 +00:00
Allan Jardine
01ffda313f New: Defered loading feature for server-side processing. With this feature enabled (controlled by the new initialisation parameter iDeferLoading) DataTables will not make a request to the server for the first page draw - rather it will use the data already on the page (no sorting etc will be applied to it). iDeferLoading is used to indicate that defered loading is required, but it is also used to tell DataTables how many records there are in the full table (allowing the information element and pagination to be displayed correctly). The intention of this feature is to improve the progressive enhancement foundation and accessibility of DataTables. 2011-03-06 14:54:54 +00:00
Allan Jardine
83db797888 Start 1.8.0 development :-) 2011-03-06 14:54:01 +00:00
Allan Jardine
91bac43b15 Fix: When removing stripe classes, look only at the direct tbody tag, not nested which could remove classes you want to keep! 2011-03-02 19:08:20 +00:00
Allan Jardine
25840887e4 Version 1.7.6 development complete 2011-03-01 19:11:32 +00:00
Allan Jardine
c5e98a94db Updated: Bring jQuery bundled with DataTables to current release - 1.5.1 2011-03-01 18:59:50 +00:00
Allan Jardine
8c37c48e00 Fix: Internal footer height for scrolling table should be set to 0, just like the header is 2011-02-27 12:39:11 +00:00
Allan Jardine
ce57597ae6 Fix: When unbinding DT namespaced events in fnDestroy, also unbind anything attached to the wrapper element 2011-02-26 19:34:46 +00:00
Allan Jardine
d5b106a2a2 Fix: Namespace all events added via jQuery (using the 'DT' namespace) to make events easy to remove in fnDestroy.
Fix: Remove all added events in fnDestroy, otherwise DataTables will leak memory like crazy when the destroy function is called
2011-02-26 12:32:56 +00:00
Allan Jardine
fdef8e02c3 Fixed: The scrolling header container should really be width:100% rather than a fixed width. The pixel width was trying to do width:100% and succeeding, but needing to be calculated rather than done natively. 2011-02-24 19:07:45 +00:00
Allan Jardine
bd0115d838 Fix: fnUpdate wasn't updating cells which were hidden by fnSetColumnVis or bVisible. It does now. 2011-02-22 21:23:06 +00:00
Brian Abreu
c01dda2a60 Fixed: fnGetData and fnGetNodes to return null when a row number is passed in that is out of the table's range.
Signed-off-by: Allan Jardine <allan.jardine@sprymedia.co.uk>
2011-02-17 18:47:25 +00:00
Allan Jardine
6641866868 Fixed: The instance that is stored (oSettings.oInstance) could contain muliple tables in a single instance, when tables are created with a selector that includes multiple tables. This could make API access a bit more tricky (3963) so now store a unique instance of the DataTables object for each individual instance. 2011-01-29 08:53:42 +00:00
Allan Jardine
bad588e6f2 Bump version to 1.7.6.dev 2011-01-17 22:13:06 +00:00
Allan Jardine
c12e8ce3b5 Fix: Trival comment change in function header 2011-01-17 22:11:42 +00:00
Allan Jardine
537e3e9595 Fixed: Table width calculations need to be done on the outerWidth, rather than 'inner', otherwise things simply don't add up (and IE get's a bit confused - fair enough). 2011-01-17 22:10:16 +00:00
Allan Jardine
c0cfe5c9e9 Finish 1.7.5 development 2010-12-15 21:54:11 +00:00
Allan Jardine
525fad090e Fixed: fnInitComplete was not the last thing to be executed when using DOM source. IT was possible that you could set sAjaxSource in fnInitComplete which would then trigger DataTables to do an Ajax call incorrectly. 2010-12-15 21:23:24 +00:00
Allan Jardine
83c0ab8888 Fixed: fnDrawCallback was actually the first of the draw callback functions that was called (the internal callbacks were called later). This was incorrect and we now loop over the array to get the order we want. At some point in future it might be required to have an ordering if these draw callbacks become interdependant. 2010-12-14 20:42:31 +00:00
Allan Jardine
65b7c9b1e6 Performance: Re-written the sorting implementation so it doesn't use either eval() of $.inArray(). inArray was found to have a serious negative effect on IE which counts operations to give the 'script is running slow' error message - the new implemention uses a value / key reverse mapping to make the look up as fast as a single object parameter retreival. Furthermore, I've done some optimisation and feature completeness work on the non-eval version of the sorting (previously the AIR sorting method) and I've found this to be at least as good (faster in some cases) than the old eval() sort, so this is now the default and only sorting method DataTables provides - 2922 2010-11-28 14:42:38 +00:00
Allan Jardine
fbe83c7b44 Updated: fnAdjustColumnSizing when called with 'false' as the first (and only) parameter will now apply the calculated column sizes to the table when scrolling is being used. This allows a non-Ajax update to occur if using server-side processing. Thanks to Cat Weismann for this patch. 2010-11-18 21:57:23 +00:00
Allan Jardine
3514563d9c Updated - now using jQuery 1.4.4 as the copy of jQuery included in the DataTables distribution. Passes all unit tests 2010-11-17 08:25:07 +00:00
Allan Jardine
837ae99479 Fixed: When using server-side processing and having called fnDestroy, don't make another XHR to the server as the data won't be used - 3375 2010-11-17 08:10:49 +00:00
Allan Jardine
5b677bcdf7 Fix: Correctly add the sClass to the TH elements in the header 2010-11-04 21:26:11 +00:00
Allan Jardine
74654f84f4 New: Add bScrollAutoCss option (default true). This allows you to control the scrolling styles with CSS, where as normally DataTables will set (and override) the styles itself. This is useful for if you want to have a scroll bar showing at all times (normally auto). 2010-11-04 18:17:34 +00:00
Allan Jardine
946eefe054 New: Column visibility options in DataTables (bVisible and fnSetColumnVis) now take into account more than one row in THEAD and TFOOT. Please note that colspan and rowspan are NOT supported when using column visibility options in the header and footer, and will very likely have effects which are not at all desirable. As such there are conditions on this use (note that if you only have one row in the header / footer, then this has no impact), specifically the number of cells in the header / footer much be equal to the columns * rows (in each one). This way DataTables can accurately add and remove the cells as needed. The cells may be either TH or TD elements, but DataTables still requires at least one TH element for each column.
Updated: Previously when multiple cells were detected as unique to a column the last one would be given priority (i.e. sorting event handler etc). This is now no longer the case and the first will take priority.
2010-11-02 18:25:00 +00:00
Allan Jardine
eec881b8ac Fixed: Remove the 'sNames' parameter that was introduced for server-side processing in 1.7.4. The parameter 'sColumns' actually performs exactly this task already. Doh. Also update the example PHP to take this into account - 3218 2010-10-31 17:16:35 +00:00
Allan Jardine
e4e2b0d11b Start 1.7.5 development 2010-10-31 17:14:10 +00:00
Allan Jardine
9f0e9e0989 Finish 1.7.4 development 2010-10-30 08:02:14 +01:00
Allan Jardine
a274d44f0c Fixed: Couple of minor jsLint highlighted errors - nothing funcational, just tidy code. 2010-10-30 07:18:25 +01:00
Allan Jardine
2bb96f89b0 Fixed: When state saving, it was possible to have a situation where by a table would contain 'n' columns, the user would sort on the last column and then the html is modifed to only have 'n-1' columns. This resulted in a JS error when DataTables tried to restore sorting on the removed column. Now do a sanity check to ensure the sorting column is present, and if not add sorting on column 0. 2010-10-30 06:54:10 +01:00
Allan Jardine
dbb51ab117 Updated: A warning is now given if you pass in aTargets (for aoColumnDefs) as something other than an array (since this is not valid). 2010-10-30 06:44:34 +01:00
Allan Jardine
4ec3b10e3e New: fnSetColumnVis now has the option to cancel the redraw by passing the third parameter to the function as false (default is true). 2010-10-30 06:39:48 +01:00
Allan Jardine
47d5a6781a Fixed: When pressing a meta key (i.e. an arrow key) in the search box and the search value didn't change, this was casuing a redraw to occur where one was not needed - 2933 2010-10-30 06:35:30 +01:00
Allan Jardine
a6365b3f69 Updated: Server-side processing script for column re-ordering has been updated to take account of sNames parameter which is sent in from DataTables, and also brought up to date with the main server-side processing script.
Changed: From the previous commit sNames sent from the client to server is now a comma seperated list of sNames and is always sent regardless of if names are given or not. This matches the sName formatting for the server-to-client return.
2010-10-29 08:48:13 +01:00
Allan Jardine
e7ffbb13fd Fixed: IE6 and IE7 were having issues with scroll X and jQuery UI theming - specifically the elements which should have been hidden by the header scrolling were visible. This is fixed with a position: relative - 3180 2010-10-28 22:08:29 +01:00
Allan Jardine
1e1e8f0104 New: Column names, if defined, are submitted to the server-side for server-side processing. This is useful for the column ordering information, since it is possible for the server to be expecting a different column order from what DataTables is using - specifically with the column indexes such as sSearch_{i}. 2010-10-28 22:07:03 +01:00
Allan Jardine
f57434fc5b New: Addtinoal ability to control state saving through two new initialisation parameters "fnStateLoadCallback" and "fnStateSaveCallback". Documentation to be updated on datatables.net at 1.7.4 release time. Basically now you can add parameters to be save, and override parameters whic have been saved. Also useful for plug-ins which need to save state. 2010-10-28 22:03:41 +01:00
Allan Jardine
77ce64fae3 Update: Remove unused settings class variable iDefaultSortIndex (the was long ago replaced with aaSorting 2010-10-23 17:38:44 +01:00
Allan Jardine
12c81b8e65 Updated: Store a complete representation of the column visibility state in aoData[]._anHidden (i.e. put in nulls for elements which are visible) to make manipulation much easier. 2010-10-23 17:36:55 +01:00
Allan Jardine
1dd9630d53 Updated: Slightly faster code for _fnStringToCss - thanks to sd_zuo, 3036 2010-10-18 09:26:37 +01:00
Allan Jardine
1e9aaee457 Updated: Upgrade to jQuery 1.4.3
Fixed: jQuery 1.4.3 seems a lot more keen to call the $.ajax error handler, which was causing the unit tests to alert errors a lot when dealing with Ajax calls, since it can make multiple calls at the same time. I've altered the check in the default error handler to look for a prase error before alerting now.
2010-10-17 08:14:29 +01:00
Allan Jardine
fe6b045af7 Fixed: Unit test 4_serveri-side "Filter 'nothinghere' - info" was failing as the information element of the table was incorrectly reporting that "1" record was being shown (start) when the filter applies ensured that no records were actually being shown. This was due to a strong type check against a string/number returned from the server-side processing script and a number/0. Fix is to parseInt(). 2010-10-17 07:50:51 +01:00