Thursday 1st May, 2014
Editor 1.3.0 release notes
Editor 1.3.0 is a major release of the Editor software, with a large number of new features and general improvements, including inline and bubble editing modes, improved API and full integration with DataTables 1.10.
Details of change change are available below.
Release notes
New
- New - PHP: Add
quote()
method for raw SQL access - New: Validation methods updated to provide much more control through a validation options array:
- All error messages can be customised
- Each validation method provides common validation options:
empty
- allow a field to be zero-length or notoptional
- allow a field not need to be submitted or notrequired
- short-cut for empty=false and optional=false
- New: Add a check for DataTables 1.10 or newer
- New: Chaining API - the Editor API now returns
this
in most cases (except where a value is required such asget()
!) to provide the ability to chain the API. Along with DataTables 1.10's chaining API this will be the documented way to use the Editor API from v1.3+. Options such asbutton
for theedit()
method have been marked as deprcated for this reason, although they do still work. - New: Field class and API - Editor has been reworked internally to have each field that is used in an Editor instance as its own instance. This allows the code to be restructed for performance and size, but it also provides a public interface for each field. This is, to an extent a duplication of the field specific methods of the Editor instance, where you can select a field by name, for example:
- editor.set( 'name', 'Allan' )
- editor.field( 'name' ).set( 'Allan' )
- New: Update to use DataTables 1.10's API methods internally
- New: AMD loader support for Editor as the named module
datatables-editor
. - New: Standalone Editor abilities (use Editor without a DataTable)
- New:
create()
,edit()
andremove()
methods now accept form options (the new submitOnReturn, etc). - New: Inline editing support!
- New:
edit()
andremove()
methods can haverow-selector
options passed into them now, not just a TR node - New:
ajax
option has been upgrades to operate in basically the same manner as the DataTablesajax
method.- Can now be given as a simple string as the url (effectively making the ajaxUrl option redundant)
- Or as an object to provide control over the ajax parameters
- Or as an object with REST instructions
- Or as a function for complete control
- The old ajaxUrl option has been deprecated as it is no longer required, however it is still supported and this change is backwards compatible.
- Like DataTables the
ajax.data
option can be given as a function to manipulate or replace the data being sent to the server.
- New: Full support for DataTables 1.10's server-side processing mode.
- DataTables 1.10 updates the parameters sent to the server to be more "modern". This update adds full support for these new parameters.
- Note that this replaces the 1.9- style server-side processing support. Like other parts of Editor 1.3, this update requires DataTables 1.10.
- With the
leftJoin()
enhancements, server-side processing now operates correctly on joined tables for ordering and searching! (Note that the Join() class still doesn't support server-side processing for search and ordering).
- New - PHP:
leftJoin()
method for Editor class which makes using simple left joins much easier and far more efficient than before.- The new
leftJoin() method basically uses the same syntax as SQL, giving the table name on which to do the join and the join condition. This allows DataTables to do the join in a single query, rather than the multiple queries that the
Join` class uses. - For all
object
based joins, this should replace the use of theJoin
class. However, theJoin
class is still required when performing an array join. As such it is still supported
- The new
- New: On edit, if the row is removed from the data set (perhaps due to a 'where' condition), rather than throwing an error, the row is removed from the data set.
- This is indicated by returning
null
for the row property in the returned JSON.
- This is indicated by returning
- New: PHP Editor->validate() method for checking if the data submitted is valid externally.
- New: DataTables API methods for editing the table, provided by Editor Editor will add the following methods to the DataTables API:
- editor() - Get the Editor instance, either assigned or automatically detected.
- row.create() - Create a new row
- row().edit() - Edit a row
- row().delete() - Delete a row
- rows().delete() - Delete multiple rows
- cell().edit() - Inline edit a cell
- cells().edit() - Bubble edit one or more cells
- New: HTML5 date input support. If jQuery UI is available on the page, its datepicker module will be used. Otherwise the inptu element with a type of
date
will be used. Browsers which do not support date inputs will fallback totext
input automatically - New: Focus styling for the buttons
- New: Keyboard accessiblity improvements - when multiple buttons are shown, the left and right keys can be used to navigate between them
- New: Responsive CSS - Editor now works well on iPad, iPhone and Android devices
- Form layout is altered to suit the requirements of the device that is being used to edit the table, based on the width of the available screen. On small screens the form is shown as stacked. And on devices with a width < 1024 (i.e. iPad and smaller) the lightbox is shown as consuming the whole screen.
- Unfortunately position:fixed in mobile devices is very broken when a virtual keyboard is shown, thus the need to show over the whole page, not just in a box hovering over the content like in desktop browsers.
- New: Improvements to the styling of the editing forms and display
- New: Use SCSS to give more structure to the files and provide easy mixins
- New example: Inline editing with tab to go to next / previous fields
- New: Focus styled background for bubble and lightbox editing
- New - beta: Oracle PDO driver for Editor
- New: Improved directory structure of the package
- Examples are now split into relevent areas
- PHP libraries are at the top level
- New: Close button style has a hover effect
- New: Highlight the edited row for user feedback
- New: node() method can now operate on multiple fields
- New:
val()
API method for completeness - New:
title()
can be used as a getter - New:
buttons()
calls can now set a single button using a simple string, with Editor automatically filling in the most common button type - a submit function. - New: Right-to-left text layout support
- New: bubblePosition() API method
- New:
preBlur
event, which complimentspreClose
- New: Focus on the first field that is in error on submit
- New:
focus
form option. Provides complete control over the focus behaviour of Editor when the form is displayed. - New:
closeOnComplete
form option - New: PHP validator -
unique
validator - New - PHP:
nullEmpty()
formatter- Save empty strings as 'null' on the database
- New: Add CommonJS support
- New: Animation disabling option for the show() and hide() methods
- New:
datetime
formatting function which can be used to transform from one datetime format to another - New: Fields have their
change
event automatically triggered on set
Updates
- Update - PHP: Add define check protect to the config.php file
- Update: When checking is a field should be applied to a query, base the decision on if the data was submitted to the server or not, rather than if the data is null.
- Update - PHP: If the primary key is changed on update, it is still read back successfully by using the new primary key value
- Update: Remove the optional parameters from the response JSON when not needed
- Update: Throw an error if a field has not been given a name
- Update: Nicer calander icon
- Update: Events no work in the same way as events for DataTables
- Documented events no longer have the
on
prefix and are camelCase. This is done for naming consisteny with DataTables 1.10 whose events are also camelCase. - Events are all fired with the namespace
dte
(DataTables usesdt
). This actually has very little baring on any interaction since the events are not propagated through the DOM (might be removed). - Passing events in using the constructor is now deprecated and will not be documented in 1.3. Using the
on()
method is how to listen for events. - These changes are all fully backwards compatible. The old
on
style events and constructor events will continue to work as in 1.2-, but the new style will be the documented events.
- Documented events no longer have the
- Update: Label / value pairs can now take objects
- The checkbox, radio and select inputs all have label / value pair inputs, which was previously an array. Now an object can also be given with the key / value being used
- Update: Database drivers use FETCH_ASSOC by default now
- Update: Bootstrap compatibility for Editor 1.3
- Update: All examples updated to use the new
ajax
option - Update:
create()
,edit()
andremove()
arguments updated for the new chaining API structure to have the title and buttons arguments optional. - Update: the
show
parameter default ofcreate()
,edit()
andremove()
has been changed fromtrue
tofalse
. This is done for the chaining API, since you can now just calledit().display()
to edit a row. - Update: On delete, row ids are sent in the
id
property as an array rather than indata
. This is for consistency. - Update: the
dbTable
parameter has been removed from the initialisation. This was just confusing between the domTable and dbTable parameters, and dbTable was virtually never used. The update toajax
can be used if you want to submit additional parameters such as dbTable. - Update:
domTable
has been renamedtable
sincedbTable
is removed. This is a backwards compatible change,domTable
can still be used, buttable
is recommended - Update: Editor is now built as a DataTables 1.10 extension
- Update: Add a transparent border around the Editor display lightbox for more visual appeal
Fixes
- Fix: SQL Server needed a couple of
GO
statements - Fix: Documentation for the database headers was off
- Fix: SQL Server driver didn't work with a port specified
- Fix: If the primary key is specified in the create, use the key given
- Fix: localStorage example used the incorrect id for row finding
- Fix: If a column name matched a php function name, an error could occur
- Fix: Potential async error on submit. If, using the API, to open a form before the edit is complete, the information stored for the next edit could potentially be removed, resulting in a Javascript error.
- Fix: Checkbox and radio inputs have nicer styling
- Fix: Remove redundant code from the lightbox controller
- Fix: Button labels defined as an extended button were being overwritten by the language settings.
- Fix: Back / next example was throwing errors if you try to go beyond the extent of the table
- Fix: The submitted data tab now does the data submitted as HTTP varaibles rather than JSON (it is not submitted in JSON so this was misleading).
- Fix: Validate methods should check for a null value and allow it unless the field is required.
- This is done to allow fields which are not required to not be submitted. In the case where the field is not sent as part of the forms data, the value checked for validation is null (this is the only way it can be null - passing in 'null' gives the string null!) so the validation checks can see if that is a valid value or not.
- Possibly this should be split into another option? A required() method perhaps. The problem with the current method is that null and '' are treated the same - so where '' is a valid input, but you want to require it, you would need to write a custom validation method at the moment. Problem with spliting it up is it makes the initilaisation more verbose
- Fix: validate() should use the set formatter return if the server formatter was specified
- Fix: Numeric validation wasn't correctly respecting the required flags
- Fix - docs: Fix typos
- Fix example: Correct link in tableFormatting example
- Fix: localStorage example couldn't delete multiple rows
- Fix - PHP: Date formatter was stripping time part