Commit Graph

50 Commits

Author SHA1 Message Date
Ben Thomson 3eac21219f
Clean up index functionality in Repeater widget (#4424)
- Remove $indexCount property, as it is no longer needed
- Determine highest key number in data, and increment when adding item
- Remove some old code and dependencies

Fixes #4402.
2019-06-29 13:42:45 +08:00
datune a8d9dcf985 Fix group index mapping in Repeater widget (#4334)
Fixes a bug which causes grouped repeaters to lose data when repeater items are re-ordered and saved, due to the data indexes not being correctly mapped to the corresponding form widget.

Credit to @datune.
2019-05-14 23:34:12 +08:00
Ben Thomson ee2b53fe71 Add hidden "loaded" flag for repeaters
This allows the repeater to retrieve the load value
from the model only on initialisation. Any further
requests to the repeater (ie. AJAX requests) should
use the POST data.
2019-04-11 17:57:27 +08:00
Ben Thomson ac98f70a25 Revert reordering handler changes 2019-04-11 10:37:39 +08:00
Ben Thomson a00e546f5f Clean up processItems() method 2019-04-10 13:20:51 +08:00
Ben Thomson 9b5bd83f10 Reset indexes when processing POST data 2019-04-09 15:35:07 +08:00
Ben Thomson f49b5ab4b8 Add callback for handling sorted repeater items 2019-04-08 23:40:41 +08:00
Ben Thomson 332ed62931 Increment index count after new item is created
Effectively starts the repeater item indexes from 0
2019-04-08 14:37:36 +08:00
Luke Towers bfe03803e6 Fix the repeater on every context, not just static page fields 2019-04-05 09:00:26 -06:00
Luke Towers b4b4b1b566 Remove extra __index_ and __group_ fields from the Repeater and use only the data itself to handle initializing widgets and processing data.
Refs: #4230
2019-04-04 01:23:32 -06:00
Luke Towers 4fbe3fdd8f removed extra line of whitespace 2019-04-01 12:41:08 -06:00
Luke Towers ecccafa319 Fix issue where grouped repeaters stopped working in a recent build. Refs: 13a7cc915d (commitcomment-32986586) 2019-04-01 12:37:32 -06:00
Luke Towers 3954704dda Fix issue with multiple repeaters with the same fieldname embedded in the same controller
There was a conflict between two repeaters that had the same fieldName (data) bound to the same controller. Example:

Controller: Events
Manages a ReportTemplate model with a custom popup Form widget that uses a grouped repeater with the field name data to define the available "fields" within a ReportTemplate
Also manages Report models through a relation controller that uses a Form widget with a regular repeater with the field name data that defines the values of the fields defined by the associated ReportTemplate.

Since both repeaters had the field name of "data", but one of them was grouped and the other wasn't, this would cause an issue in Repeater::processExistingItems() where the grouped repeater would attempt to process the ungrouped repeater's data which would then fail. This issue could easily cause many other vastly more confusing and difficult to detect issues in cases where multiple repeaters with the same field name AND the same mode (grouped vs regular) existed on the same page under different contexts. The simple solution is just to ensure that the indexInputName and groupInputName are both taking the repeater's alias into account when being generated to ensure that everything stays unique like it should.
2019-03-18 12:39:12 -06:00
Ben Thomson 13a7cc915d Use Form getSaveData method when saving form widgets within repeaters (#4160)
Credit to @bennothommo
2019-03-15 22:39:34 -06:00
Luke Towers d5e7419312 Support enableDefaults on repeaters using grouped mode 2019-03-12 01:19:37 -06:00
Panagiotis Koursaris bb0a23f54c fixes enable Defaults on repeater (#4129)
Credit to @panakour
2019-02-11 09:54:55 -06:00
Ben Thomson 970d5622c0 Allow datatables to work within a repeater (#4102)
Fixes #4063. Credit to @bennothommo.
2019-02-04 12:50:40 -06:00
Antonie Hogewoning 16ca521cd0 Fix setting default values for repeater in update context (#4098)
Credit to @CptMeatball
2019-01-31 13:50:21 -06:00
Nathan van der Werf 0f0d108da0
Remove unused imports 2018-08-24 19:51:59 +02:00
Nathan van der Werf 66fa03f17e
Revert "Remove unused imports"
This reverts commit 742a5f415b.
2018-08-24 19:40:40 +02:00
Nathan van der Werf 3a918ad200 Remove "null" assignments 2018-08-15 18:33:24 +02:00
Nathan van der Werf 742a5f415b Remove unused imports 2018-08-15 18:27:36 +02:00
Luke Towers cbed54a263 Implemented minItems repeater property on client & server
Also implemented maxItems on server (previously only client). Fixes https://github.com/octobercms/october/issues/3668
2018-08-12 01:33:51 -06:00
Luke Towers 6774920003 Finish implementing titleFrom option for Repeaters
Ref: e7609aa5e8
2018-08-11 20:27:53 -06:00
Luke Towers d164145229
Fixes #2613
This fixes #2613 by reloading the form widgets with the modified data after `model.filterFields`. **NOTE**: `$this->processExistingItems()` isn't simply just moved to `prepareVars()` because that messes up the adding new repeater item functionality by repeating the content from the fields for the last item in that group that already exists on the repeater.
2017-11-01 14:18:41 -06:00
Luke Towers 2a16847724 Add support for readOnly Repeater Widgets (#2960)
* Add support for previewMode in Repeater FormWidget
Refs: #2724, 5f91c45f79
* Add support for previewMode in Repeater FormWidget

Refs: #2724, 5f91c45f79

* Add support for previewMode in Repeater FormWidget

Refs: #2724, 5f91c45f79

* Add support for previewMode in Repeater FormWidget

Refs: #2724, 5f91c45f79
2017-07-08 13:34:04 -06:00
Samuel Georges 6a6378a24d Strip indexes from repeater data sets 2017-04-26 08:10:45 +10:00
Samuel Georges cb56c61e36 Retain true backward compatibility with early repeater 2017-04-24 19:06:59 +10:00
Samuel Georges d7ef8cdcf8 Minor logic change 2017-04-24 13:24:57 +10:00
Samuel Georges 6825ce12c8 Allow external group field definition - Refs #2772 2017-04-24 13:24:57 +10:00
Samuel Georges c52f91a6d2 Collapsed items should default to or include the group name - Refs #2772 2017-04-24 13:24:56 +10:00
Samuel Georges acfe619cb9 Add button lacks loading state - Refs #2772 2017-04-24 13:24:55 +10:00
Samuel Georges ac7da4634a Implement working prototype of a grouped repeater
Refs #2772
2017-04-22 22:01:17 +10:00
Samuel Georges 83e80745b3 Fixes issue with index incrementation 2017-04-22 21:40:35 +10:00
Samuel Georges 46fcdbc636 Progress on repeater field groups
Refs #2772
2017-04-22 21:04:37 +10:00
Samuel Georges b841f9e066 {@inheritDoc} -> @inheritDoc 2017-03-16 06:26:14 +11:00
Samuel Georges e9cc782120 Peer review #2723 2017-03-01 14:31:37 +11:00
Luke Towers 5c56c9579d Add support for maxItems to the Repeater FormWidget
Refs: #2710
2017-02-28 20:36:32 -06:00
Samuel Georges 29040b416c Allow redirect: false on importExportController
Implement getFieldName() method
2016-11-28 07:50:06 +11:00
Samuel Georges 7b0f33e9b3 Adds an isNested flag to Form widget
This is useful when a form renders another form inside, specifically the repeater. In these cases the model and data will diverge, and it also provides an opportunity to not apply extension logic to nested form fields.
Fixes #2257
2016-11-05 09:53:23 +11:00
Samuel Georges 675a6a4224 Code improvements
Refs #2235
2016-07-23 14:22:36 +10:00
Anže Časar 79bb4c2035 Nested DependsOn 2016-07-22 00:38:32 +02:00
Samuel Georges d24f7252b3 Stops nested repeaters populating from previous sibling - Fixes #1381 2015-08-22 10:18:41 +10:00
Samuel Georges fc04bd1b4c Added new makeFormWidget() method to WidgetMaker for rendering form widgets individually 2015-08-07 19:06:04 +10:00
Samuel Georges b010732796 These methods should be protected, update client lang 2015-08-04 10:01:17 +10:00
Samuel Georges 2cf8ad8c27 Minor fixes, improvements to full screen rich editor 2015-03-06 18:54:45 +11:00
Samuel Georges fe5deb68e7 Repeater should populate with existing dataset 2015-03-05 19:02:23 +11:00
Samuel Georges be2e40e69f Add hypothetical loading of data 2015-03-04 19:13:15 +11:00
Samuel Georges 25d4c11f3f Typo 2015-03-04 19:09:59 +11:00
Samuel Georges 022eb4d673 Create initial version of repeater form widget 2015-03-04 19:05:32 +11:00