Friday 31st August, 2012
Editor 1.2.1 release notes
Editor 1.2.1 is now available, with a number of API refinements and bugs addressed. The PHP server implementation now has the ability to do self-referencing joins, and the client-side has a few new API methods and events.
Release notes
New
- New - API:
get
method now allows no parameters to be passed to it. If that is done, then the values of all fields are returned as an object. - New - API:
fields
method - new method which will get a list of all the field names that the instance has been configured with. - New - Events: onPreOpen and onPreClose events which allow the open / close action to be cancelled.
- New - example: Close confirmation on unsaved changes using the new features in 1.2.1.
- New - PHP:
get
andset
methods for the Join class.set(false)
will tell the Join instance not to perform any write operations on the join table, whileget(false)
will not perform any read operations (the former is probably significantly more useful!). This is easier than setting all of the fields in the join table toset(false)
(for example) if you don't want the child join table to be updated. - New - PHP:
aliasParentTable
method for theJoin
class. This allows the parent table to be aliased thus allowing self referencing Join queries. - New - PHP:
where
method for the Editor class which can be used to apply a condition to the database being queried. Conditions such aswhere( 'name', 'A%', 'like')
orwhere( 'amount', '50', '<' )
can be used. Multiple conditions can be added by calling the method multiple times. Caution is very much advices when using this method - please do not include the conditional field(s) in the fields which can be edited by the end user - they could remove the row from the condition which will result in undefined behaviour. - New - PHP: Ability to perform self referencing joins, with example (joinSelf). This is done through the use of the aliasParentTable method.
- New - PHP: Aliasing fields to read columns from the parent table is now possible, using standard SQL notation - there are a few conditions though - the field must be read-only, and it must be given a name that doesn't include a dot (so DataTables doesn't attempt to use Javascript object notation to read it!). This is designed to compliment the aliasParentTable option so that fields from the parent table can be read (aliasParentTable isn't required - you can read options for the original name if needed!).
- New - PHP: Provide an
sql
method for the Database class which allows SQL statements to be passed straight through to the driver and executed against the database. This can be useful to set system variables - for example character sets for the connection.
Updates
- Update - examples: Update table only data example text to take account of the new 'row' return parameter from 1.2
- Update - examples: Bootstrap integration: Update to Bootstrap 2.1
- Update - examples: Update jQuery UI to v1.8.23
- Update - PHP: Renaming the Join internal method 'get' to 'data' so we can make 'get' and 'set' public methods indicating if a get/set should be performed on the join. Note that this has no external effect - the Join class's 'get' method was internal only before and used only by the Editor class which has been updated.
Fixes
- Fix - Core: Using Editor without loading TableTools would result in a Javascript error, due to setting the language preferences without checking for the existence of TableTools first.
- Fix - PHP: Validation of required fields was a little broken due to an incorrect string length calculation.
- Fix - PHP: ORDERY BY (
order
method) had a couple of issues which caused it to work incorrectly, which are now fixed. - Fix - PHP: Query prototype was out of date - also needs port passed in (i.e. 5 parameters)
- Fix - PHP: Check that the joining field has been included in the Editor field list - otherwise it won't work and it is fairly obscure as to why not.
- Fix - PHP: When joining tables, before we assumed that the primary key that is defined in the Editor class would be used for the join, but this isn't always true - its likely to be usually true, but not always. Instead, the parent field from the join statement is now used. As noted, this will usually be the pkey of the parent, but doesn't need to be any more. Also worth noting that the field that is used for the join must be in the Field list for the Editor instance - since the pkey is by default, this isn't normally a problem.