Friday 22nd June, 2012

Editor 1.1.0 release notes

Release notes

New

  • New: API method - add the new 'field' API method which allows easy access to the properties and methods of a field type plug-in which has been configured for a particular field. For example to get the value of a field, rather than (internally) looking up the field type and then calling the get method, we can do inst.field('name').get(). THis is done by using a closure to make the field configuration parameter irrelevant, since that is where the complication for using the configured field methods come in - instead this way of doing it will automatically add the configuration object to the parameters.
  • New: Radio field types can have ipOpts passed as a simple array of values, rather than objects now - so ipOpts: [ 0,1,2,3 ] would be valid, and the values used for both label and value of the checkbox. THe old form of an object is still valid as well, giving extra flexibility to the radio control.
  • New: onInit[Create|Edit|Remove] events / callbacks which are called for each of the three actions just prior to the form being displayed. This is useful for developers who want to set the form up with specific fields for each of the actions (onOpen could have been used, but the form is already displayed at that point and this.s.action is needed to determine which action is being used).
  • New: Ability to define custom classes (/override the built in classes) for all elements which are created by Editor.
  • New: Bootstrap display option (this will be moved into an independent plug-in, but is in the core at the moment). Uses the bootstrap 'modal' control to display the form.
  • New: REST example - in order to keep the example fully portable, there is no URL rewriting being done (i.e. not .htaccess file is needed in Apache) - so the URls are not a "clean" as a deployed REST implementation might be, but it does show all aspects of how REST interfaces can work with Editor.
  • New: Full REST support for Editor - you can now specify ajaxUrl as an object (the existing 'as a string' method is still fully supported) with create, edit and remove properties which will direct the different actions of Editor to different addresses. 'id' is a macro which can be used to modify the URL on-the-fly with the ID of the row being edited/deleted (multiple delete rows are separated by a comma - information is still sent to the sever in the 'data' array if required).
  • New: Ability to set the HTTP method using the ajaxUrl string, or if using it as an object, its three child properties. This is done by having the HTTP method you wish to use at the start of the string, followed by a space and then the URL - for example "GET /users" or "POST /users/create" etc. This is done to facilitate full REST support for Editor.
  • New: dataProp now behaves in exactly the same way as mDataProp in DataTables - i.e. it allows deeply nested objects to be read / written to, through dotted javascript object notation (i.e. "details.name"), or as a function. If used as a function Editor will pass "editor" as the type specific parameter to the 'get' function.
  • New example: Twitter Bootstrap integration - this example shows how Bootstrap can be integrated with Editor, TableTools and DataTables to create a beautiful editing environment
  • New example: Showing the updated capabilities of dataProp allowing deeply nested objects.
  • New example: Previous / next saving buttons using the TableTools API

Updates

  • Update: Update localStorage example for the extra parameter being passed into ajax for the method
  • Update: Alter the date format for the table only date example to not have leading zeros for the date
  • Update: Update example to take account of TableTools tag change
  • Update: Use × for the envelope display control's close 'icon'
  • Update: Update the field types to be more space efficient - specifically using jQuery to create elements and use a local base object where common functions are defined
  • Update: Remove the local variable for all of Editor FieldTypes and replace with references to either Editor.fieldTypes or a more lightly scoped variable
  • Update: Optimising Editor for size - two techniques used here: 1. DataTable.Editor renamed to a local variable called Editor, which is aliased to DataTable.Editor. 2. Editor.prototype locally aliased to Editor_prototype to allow the compiler to rename that proeprty
  • Update: Update the focus selectors to not throw and error if their elements aren't available
  • Update: Use data-dte-e for the wrapper HTML. Although not strictly needed right here and now for 1.1, it will be useful for when renderers are added and keeped everything in line.
  • Update: Add the ability for select fields to be dynamically updated
  • Update: Harmonise on the new field API method for field access methods. There is a performance penalty for this since the proxy field object needs to be built whenever we access a field property - but this is acceptable given that field numbers are generally low (unlike DataTables rows!). If needed it could be that we cache the created object.
  • Update: Have the submit method use the public API to get field values rather than doing it itself
  • Update: Alter _callbackFire to allow an array of events to be passed in, since some events can be fired one after another - small optimisation in terms of code reuse
  • Update: Update the examples to not use onSubmitLoaded (that particular event was never publicly published, and was in fact incorrect, which is why it was removed). The examples now use onPostSubmit
  • Update: Redo how the events work internally - rather than having a separate name for the store and the event, we now just use the event name for the store, saving a bit of space (about 1K when minified, so well worth it - also make more sense sanity wise!). There is no external interface change here - the events passed on init and using the API are exactly the same as before.
  • Update: Remove onSubmitLoaded - it was only being fired, never registered - there was confusion between it and onPostSubmit, which is now the event for this.
  • Update: Loop over the _callbackReg option and the init events which results in a nice code size reduction in the constructor.
  • Update: Security fix - don't show mysql errors on output

Fixes

  • Fix: If a non-array non-string (i.e. a numeric value) was passed to the radio control, it would cause a Javascript error on the 'split' this is now addressed.
  • Fix: IE7 needs key binding events to be attached to document rather than windwo
  • Fix: IE7 fires the window resize event early (page initialisation) which could cause a script error.
  • Fix: IE7 wouldn't apply a default selection to checkboxes
  • Fix: Syntax highlighting of the init code and xhr send/response was not working well in IE6/7/8 - it does now.
  • Fix: When the lightbox is already shown, and you request it to be shown again, it would set the opacity to be 0 and then fade back in, resulting in an ugly flash. It now maintains state and will only perform its fading as and when needed.