diff --git a/css/ComplexTableField_popup.css b/css/ComplexTableField_popup.css deleted file mode 100644 index 76bdc4ee9..000000000 --- a/css/ComplexTableField_popup.css +++ /dev/null @@ -1,35 +0,0 @@ -html { overflow-y: auto !important; } - -body { height: 100%; } - -#ComplexTableField_Popup_DetailForm input.loading { background: white url(../images/network-save.gif) left center no-repeat; padding-left: 16px; } - -.PageControls { padding: 5px; width: 100%; } -.PageControls * { vertical-align: middle; } -.PageControls .Left { width: 33%; } -.PageControls .Count { width: 33%; text-align: center; } -.PageControls .Right { width: 33%; text-align: right; } - -.ComplexTableField_Popup td.hidden { display: none; } -.ComplexTableField_Popup th.HiddenField { display: none; } -.ComplexTableField_Popup span.right { float: right; clear: none; } -.ComplexTableField_Popup span.left { float: left; clear: none; } -.ComplexTableField_Popup form p.checkbox input { margin: 0pt 1px; } -.ComplexTableField_Popup form ul.optionset { margin: 0; padding: 0; } -.ComplexTableField_Popup form ul.optionset li { margin: 4px 0; } -.ComplexTableField_Popup form div.Actions input { font-size: 11px; margin-top: 10px; } - -/* Pagination */ -#ComplexTableField_Pagination, #ComplexTableField_Pagination * { vertical-align: middle; } - -#ComplexTableField_Pagination { margin-top: 10px; margin-left: auto; margin-right: auto; font-size: 11px; } -#ComplexTableField_Pagination a { /*font-size: 1.2em;*/ font-size: 13px; font-weight: bold; text-decoration: none; width: 1px; height: 1px; margin: 1px; } -#ComplexTableField_Pagination a:hover { background: none; } -#ComplexTableField_Pagination span { display: inline; font-weight: bold; font-size: 15px; color: #f00; } -#ComplexTableField_Pagination div { display: inline; } - -#ComplexTableField_Pagination_Previous { padding-right: 10px; } - -#ComplexTableField_Pagination_Next { padding-left: 10px; } - -#ComplexTableField_Pagination_Next img, #ComplexTableField_Pagination_Previous img { margin: 0 3px 2px; } diff --git a/docs/en/reference/complextablefield.md b/docs/en/reference/complextablefield.md deleted file mode 100644 index e9def0cfc..000000000 --- a/docs/en/reference/complextablefield.md +++ /dev/null @@ -1,135 +0,0 @@ -# Complex Table Field - -## Introduction - -
- This field is deprecated in favour of the new [GridField](/reference/grid-field) API. -
- -Shows a group of DataObjects as a (readonly) tabular list (similiar to `[api:TableListField]`.) - -You can specify limits and filters for the resultset by customizing query-settings (mostly the ID-field on the other -side of a one-to-many-relationship). - -See `[api:TableListField]` for more documentation on the base-class - -## Source Input - -See `[api:TableListField]`. - -## Setting Parent/Child-Relations - -`[api:ComplexTableField]` tries to determine the parent-relation automatically by looking at the $has_one property on the listed -child, or the record loaded into the surrounding form (see getParentClass() and getParentIdName()). You can force a -specific parent relation: - - :::php - $myCTF->setParentClass('ProductGroup'); - - -## Customizing Popup - -By default, getCMSFields() is called on the listed DataObject. -You can override this behaviour in various ways: - - :::php - // option 1: implicit (left out of the constructor), chooses based on Object::useCustomClass or specific instance - $myCTF = new ComplexTableField( - $this, - 'MyName', - 'Product', - array('Price','Code') - ) - - // option 2: constructor - $myCTF = new ComplexTableField( - $this, - 'MyName', - 'Product', - array('Price','Code'), - new FieldList( - new TextField('Price') - ) - ) - - // option 3: constructor function - $myCTF = new ComplexTableField( - $this, - 'MyName', - 'Product', - array('Price','Code'), - 'getCustomCMSFields' - ) - - -## Customizing Display & Functionality - -If you don't want several functions to appear (e.g. no add-link), there's several ways: - -* Use `ComplexTableField->setPermissions(array("show","edit"))` to limit the functionality without touching the template -(more secure). Possible values are "show","edit", "delete" and "add". - -* Subclass `[api:ComplexTableField]` and override the rendering-mechanism -* Use `ComplexTableField->setTemplate()` and `ComplexTableField->setTemplatePopup()` to provide custom templates - -### Customising fields and Requirements in the popup - -There are several ways to customise the fields in the popup. Often you would want to display more information in the -popup as there is more real-estate for you to play with. - -`[api:ComplexTableField]` gives you several options to do this. You can either - -* Pass a FieldList in the constructor. -* Pass a String in the constructor. - -The first will simply add the fieldlist to the form, and populate it with the source class. -The second will call the String as a method on the source class (Which should return a FieldList) of fields for the -Popup. - -You can also customise Javascript which is loaded for the Lightbox. As Requirements::clear() is called when the popup is -instantiated, `[api:ComplexTableField]` will look for a function to gather any specific requirements that you might need on your -source class. (e.g. Inline Javascript or styling). - -For this, create a function called "getRequirementsForPopup". - -## Getting it working on the front end (not the CMS) - -Sometimes you'll want to have a nice table on the front end, so you can move away from relying on the CMS for maintaing -parts of your site. - -You'll have to do something like this in your form: - - :::php - $tableField = new ComplexTableField( - $controller, - 'Works', - 'Work', - array( - 'MyField' => 'My awesome field name' - ), - 'getPopupFields' - ); - - $tableField->setParentClass(false); - - $fields = new FieldList( - new HiddenField('ID', ''), - $tableField - ); - - -You have to hack in an ID on the form, as the CMS forms have this, and front end forms usually do not. - -It's not a perfect solution, but it works relatively well to get a simple `[api:ComplexTableField]` up and running on the front -end. - -To come: Make it a lot more flexible so tables can be easily used on the front end. It also needs to be flexible enough -to use a popup as well, out of the box. - -## Subclassing - -Most of the time, you need to override the following methods: - -* ComplexTableField->sourceItems() - querying -* ComplexTableField->DetailForm() - form output -* ComplexTableField_Popup->saveComplexTableField() - saving \ No newline at end of file diff --git a/docs/en/reference/index.md b/docs/en/reference/index.md index f9fa9d162..002241d7d 100644 --- a/docs/en/reference/index.md +++ b/docs/en/reference/index.md @@ -3,8 +3,7 @@ Reference articles complement our auto-generated [API docs](http://api.silverstripe.org) in providing deeper introduction into a specific API. * [BBCode](bbcode): Extensible shortcode syntax -* [CMS Architecture](cms-architecture): A quick run down to get you started with creating your own data management interface -* [ComplexTableField](complextablefield): Manage records and their relations inside the CMS +* [CMS Architecture](cms-architecture): A quick run down to get you started with creating your own data management interface. * [GridField](grid-field): The GridField is a flexible form field for creating tables of data. * [Database Structure](database-structure): Conventions and best practices for database tables and fields * [DataExtension](dataextension): A "mixin" system allowing to extend core classes diff --git a/docs/en/reference/tablefield.md b/docs/en/reference/tablefield.md index c71580984..8069e321c 100644 --- a/docs/en/reference/tablefield.md +++ b/docs/en/reference/tablefield.md @@ -63,12 +63,6 @@ Due to the nested nature of this fields dataset, you can't set any required colu Note: You still have to attach some form of `[api:Validator]` to the form to trigger any validation on this field. -### Nested Table Fields - -When you have `[api:TableField]` inside a `[api:ComplexTableField]`, the parent ID may not be known in your -getCMSFields() method. In these cases, you can set a value to '$RecordID' in your `[api:TableField]` extra data, and this -will be populated with the newly created record id upon save. - ## Known Issues * A `[api:TableField]` doesn't reload any submitted form-data if the saving is interrupted by a failed validation. After diff --git a/docs/en/topics/javascript.md b/docs/en/topics/javascript.md index ff1a3cd25..054c57f81 100644 --- a/docs/en/topics/javascript.md +++ b/docs/en/topics/javascript.md @@ -289,14 +289,12 @@ request](http://docs.jquery.com/Frequently_Asked_Questions#Why_do_my_events_stop ### Assume Element Collections jQuery is based around collections of DOM elements, the library functions typically handle multiple elements (where it -makes sense). Encapsulate your code by nesting your jQuery commands inside a `jQuery().each()` call. - -Example: ComplexTableField implements a paginated table with a pop-up for displaying +makes sense). Encapsulate your code by nesting your jQuery commands inside a `jQuery().each()` call. Example: :::js - $('div.ComplexTableField').each(function() { - // This is the over code for the tr elements inside a ComplexTableField. - $(this).find('tr').hover( + $('.MyCustomField').each(function() { + // This is the over code for the elements inside a MyCustomField. + $(this).hover( // ... ); }); diff --git a/scss/ComplexTableField_popup.scss b/scss/ComplexTableField_popup.scss deleted file mode 100755 index 1b5d0f10e..000000000 --- a/scss/ComplexTableField_popup.scss +++ /dev/null @@ -1,115 +0,0 @@ -html { - overflow-y: auto !important; -} -body { - height: 100%; -} - -#ComplexTableField_Popup_DetailForm input.loading { - background: #fff url(../images/network-save.gif) left center no-repeat; - padding-left: 16px; -} - -.PageControls { - padding: 5px; - width: 100%; - - * { - vertical-align: middle; - } - - .Left { - width: 33%; - } - - .Count { - width: 33%; - text-align: center; - } - - .Right { - width: 33%; - text-align: right; - } -} - -.ComplexTableField_Popup { - td.hidden { - display: none; - } - th.HiddenField{ - display: none; - } - - span.right{ - float: right; - clear: none; - } - span.left{ - float: left; - clear: none; - } - form p.checkbox input { - margin:0pt 1px; - } - form ul.optionset { - margin: 0; - padding: 0; - } - form ul.optionset li { - margin: 4px 0; - } - - form div.Actions input { - font-size: 11px; - margin-top: 10px; - } -} - -/* Pagination */ -#ComplexTableField_Pagination, -#ComplexTableField_Pagination * { - vertical-align: middle; -} - -#ComplexTableField_Pagination { - margin-top: 10px; - margin-left: auto; - margin-right: auto; - font-size: 11px; - - a { - /*font-size: 1.2em;*/ - font-size: 13px; - font-weight: bold; - text-decoration: none; - width: 1px; - height: 1px; - margin: 1px; - } - - a:hover { - background: none; - } - - span { - display: inline; - font-weight: bold; - font-size: 15px; - color: #f00; - } - - div { - display: inline; - } -} - -#ComplexTableField_Pagination_Previous { - padding-right: 10px; -} -#ComplexTableField_Pagination_Next { - padding-left: 10px; -} -#ComplexTableField_Pagination_Next img,#ComplexTableField_Pagination_Previous img { - margin: 0 3px 2px; -} \ No newline at end of file