This is a complete re-write of the plugin. There is no upgrade path from V2 to V3 at present as the options and the way the code is written are inherently different. Please check out the full documentation for V3 found in the docs folder or by viewing it online here.
Pull requests need to be made against the develop branch as a new feature. I've switched to using a GitFlow process with this repository to try keep things organized a bit more. It makes it easier for me to test and make changes to submitted pull requests before merging the feature into the develop branch. The master branch now only contains release versions of the code.
- Fixed a critical issue with the new export feature throwing an error if Moment.js and the DateColumn were not included in the page.
- Added two new events
expanded.ft.rowandcollapsed.ft.rowthat occur after there complementaryexpand.ft.rowandcollapse.ft.rowevents. - Added a new
FooTable.Exportcomponent which exposes two primary methods on theFooTable.Tableobject,.toJSON()and.toCSV(). - Added a new
arraycolumn type to make rendering JavaScript arrays as cell contents easier. - Added a new
objectcolumn type to make rendering JavaScript objects containing multiple properties as cell contents easier. - Added a new
containeroption to the filtering component. This option allows you to provide a selector to specify where the filtering form is rendered. The selector should match only a single element and if multiple are found only the first is used. - Added a new
containeroption to the paging component. This option allows you to provide a selector to specify where the paging UI is rendered. The selector should match only a single element and if multiple are found only the first is used. - Added
redrawSelfas an extra parameter to theFooTable.Cell#val(value, redraw, redrawSelf)andFooTable.Row#val(value, redraw, redrawSelf)methods. This parameter dictates whether the row or cell updates its' own DOM when a value is set. - Updated the
FooTable.Paging#pageSizemethod to also accept string values. If the parameter is not supplied or is not a valid number the current page size is returned. - Updated the
FooTable.Filtering#filtermethod to accept a single boolean param simply calledfocus, if supplied and true the default search input receives focus after the component performs a filter operation. This new param is used internally when auto applying a query after a user types in the search input, or clicks the search/clear buttons. This behavior can be disabled by setting the newfiltering.focusoption tofalse. - Updated the
.formatter()function of all column types to now accept three parameters;value,optionsandrowData.valueandoptionshave always been available, the new addition is therowDataparameter which is an object containing the current rows' parsed values, the properties of this object match the names of the columns for the current table, if no names are specified the properties will becol1,col2, etc. - Updated the
FooTable.HTMLColumn#sortValuemethod to offload additional parsing to its.parser()method. - Fixed an issue in the sorting component where values in a number column supplied as strings were being sorted as such and not as numbers as they should.
- Fixed an issue with the
FooTable.NumberColumnwhere it was converting negative numbers to positive when parsing values directly from the DOM. - Fixed the
FooTable.Table#_constructmethod which was not returning a promise as it should have been doing. - Fixes memory leak when destroying the table, properties that were holding onto references should now be cleared.
- Updated the
FooTable.Table#drawmethod to prevent unnecessary browser reflows and hide an unstyled flash of content during the initial loading of the table. (@jleider & @mrdziuban) - Updated the
FooTable.DateColumn#formattermethod to perform a check for invalid dates and return an empty string instead of"Invalid Date". (@jnimety) - Updated the
FooTable.Cell#collapsemethod to copy all attributes from the original element to the one displayed in the details row. If the element has an ID, the copied version is suffixed with"-detail"to avoid duplicates. (@mrdziuban) - Updated the
FooTable.Column#parsermethod to use jQuery's.html()method instead of.text()as the latter was decoding HTML entities which were then reinserted into the DOM which opened up the possibility of XSS. - Removed the
FooTable.Paging#_countFormatprivate method and replaced it with a newFooTable.Paging#format( string )method to make custom paging UI's simpler to implement. - Fixed an issue with column classes and styles supplied through the options not being applied to the actual column header
THelement.
- Added a new
dropdownTitleoption to the filtering component. This options specifies a title to display at the top of the column select dropdown. - Added a new
exactMatchoption to the filtering component. - Added a new utility method
FooTable.str.containsExact(string, match, ignoreCase). - Added a class
footable-filtering-searchto theform-groupof the built in search input for the filtering component. - Added
footable-first-visibleandfootable-last-visibleclasses to all cells (including headers) in either the first or last visible columns respectively. - Updated the
minoption default value from3to1for the filtering component. - Updated the load priority for rows and columns supplied via options or ajax load, they now take precedence over those supplied through the DOM to work around issues with the plugin being reinitialized multiple times on the same element.
- Fixed an issue in the
FooTable.Queryobject where phrases were not being matched correctly. - Fixed filtering component not properly clearing filters when the search input is cleared using backspace or delete.
- Fixed the resize event not being removed when the plugin is destroyed.
- Fixed an issue with unexpected sorting and filtering results if the
sortValueandfilterValueattributes contained a falsy value. The values are now subject to a strict undefined check before being passed off. - Fixed an issue with the
datecolumn type not sorting it's values as expected.
- Added
sortValuecolumn option. This option allows you to supply your own function to retrieve the sort value for a cell. - Updated filtering component internals to clean things up a bit.
- Updated filtering component search input to trigger a filtering operation on paste.
- Updated
FooTable.Filtering#addFiltermethod to accept an object orFooTable.Filteras the first argument to make custom filters easier to implement. - Updated filtering
preinitandinitto return a promise to make custom filters easier to implement. - Updated
FooTable.Filterto accept aFooTable.Queryas the query parameter along with the original plain string. - Updated paging component to expose some previously private properties to make setting a custom count label element easier.
- Fixed issue where the filtering components
minoption was not being applied. - Fixed the paging components'
countFormatoption placeholder{TR}to correctly reflect filtered rows. - Fixed preinit unhandled exception if the
tablethe plugin is initialized on has noclassattribute. - Fixed issue with the individual components .ZIP missing the
footable.core.bootstrap.min.cssandfootable.core.standalone.min.cssminified files.
- Added the
breakpointclass to the table when columns are hidden. - Added an internal key used as part of the storage keys generated by the state component. Can be changed if an update breaks backwards compatibility.
- Added the
hiddenoption that can be used for filters. When set to true the filter is always applied to the table, can not be cleared unless removed using theFooTable.Filtering#removeFilter()method and they will not effect the default UI search/clear buttons. - Updated some utility functions with additional parameter checking to avoid unhandled errors under certain scenarios.
- Updated the
FooTable.Filtering#addFilter()method to expose the last three parameters of theFooTable.Filterconstructor; ignoreCase, connectors and space. - Fixed an issue when reinitializing the plugin for a second time on a table after it's DOM had been modified by a 3rd party.
- Fixed an issue where the
FooTable.Filtering#draw()method was not setting the button to the clear icon if the filter supplied was not the default. - Fixed state component clearing filters supplied through options if the state value was an empty array.
- Fixed an issue with the incorrect sort icon appearing if a column was set to just
sorted=truewithout supplying a direction.
- Added a new state component that handles the page number, sorted column and any filters applied across sessions.
- Added in the ability to toggle the visibility of the various editing component buttons.
- Added in a new "view" button to the editing component.
- Added in
FooTable.Rows#expand()andFooTable.Rows#collapse()methods to toggle all visible rows. - Added in a new
FooTable.getRow()utility method to retrieve the currentFooTable.Rowobject given aTRelement or any of its' children. - Fixed an issue when reinitializing the plugin by doing some additional cleanup in the destroy methods for columns, rows and sorting.
- Fixed an issue with filtering not applying correctly when filters were supplied through the options.
- Fixed base
FooTable.Componentmethod signatures. - Updated the
FooTable.Row#val()method to merge supplied data instead of replacing it entirely. - Updated the
FooTable.getFnPointer()method to handle dot notation names. - Updated the requirement checks for columns so having at least one
data-breakpointsattribute is no longer required. - Updated the
FooTable.Filtering#filter()method to only apply all filters in theFooTable.Filtering#filters. - Removed the
FooTable.Table#applyFilter()andFooTable.Table#removeFilter()methods. - Removed the
FooTable.components.coreandFooTable.components.internalobjects.
NOTE
As of version 3.1.0 there are some backwards compatibility issues if you have done customizations like those seen in the custom dropdown filter example using the 3.0.x versions. The examples have been updated with the changes however the issues are listed below.
- The
FooTable.Filtering#filter()method no longer accepts any arguments and is used purely to apply all filters found in theFooTable.Filtering#filtersarray. - Due to #1 above to apply a new search filter it must now be done using the
FooTable.Filtering#addFilter(name, query, columns)method using a name of "search". - The internal, core and custom component arrays that existed within the
FooTable.Table#componentsobject have been removed. All components are now loaded into a single array. - When registering a component you now only need to use
FooTable.components.register()method instead of having to decide betweenFooTable.components.register(),FooTable.components.core.register()andFooTable.components.internal.register()due to #3 above.
- Added in a basic expandAll option for rows.
- Added in a
FooTable.Rows#load()method to make supplying the table with new data much easier. - Added in a redraw parameter to the
FooTable.Rows#add(),FooTable.Rows#update()andFooTable.Rows#delete()methods to allow for better bulk operations. - Added in new ignoreCase option for the filtering component.
- Fixed issue with breakpoints being calculated incorrectly on mobile devices.
- Fixed issue with the sorting component preventing the default action of click events from taking place. (think checkboxes not checking when in header)
- Fixed issue where the events
expand.ft.rowandcollapse.ft.rowwere not supplying the row as a parameter.
- Added the ability to filter for empty values.
- Fixed an issue where there were duplicate components being loaded when using the
FooTable.init()constructor. - Fixed an issue where the
FooTable.NumberColumn#thousandSeparatorwas being initialized with an incorrect default value. - Fixed an issue where the old instance id class was being left on the table when reinitializing FooTable on the same table over and over again.
- Added in
ready.ft.tableandpostinit.ft.tableevents. - Added new
FooTable.Table#_construct()method to allow for easier overriding. - Added in three new methods for the sorting component;
FooTable.Sorting#toggleAllowed(state),FooTable.Sorting#hasChanged()andFooTable.Sorting#reset(). - Fixed an issue where the sort direction for a column marked as sorted was defaulting to DESC instead of ASC.
- Fixed an issue where the
indexOrRowparameter for theFooTable.Row#delete()andFooTable.Row#update()methods was being ignored.
- Added a new editing component that provides the framework to create an editable table.
- Added in a new option
toggleSelectorto allow filtering of row click events. - Added in a priority to component loading.
- Added in new events
expand.ft.rowandcollapse.ft.row. - Fixed an issue with the paging component where if the total number of rows was less than the page size breakpoints would not fire.
- Fixed an issue with the paging component during resizing/drawing when there was only a single page.
- Fixed an issue with bubbled errors and deferreds in
FooTable.Table. - Fixed the sorting components icon padding on
THelements being overridden by Bootstrap. - Fixed breakpoint values being off by 1 pixel.