Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SS4 Orderablew Rows js error: this.sortable is not a function #246

Open
chtombleson opened this issue Feb 20, 2018 · 24 comments
Open

SS4 Orderablew Rows js error: this.sortable is not a function #246

chtombleson opened this issue Feb 20, 2018 · 24 comments

Comments

@chtombleson
Copy link

The orderable rows extension is not working.
SilverStripe version: 4.0.3

I get this javascript error:

GridFieldExtensions.js?m=1519162305:422 Uncaught TypeError: this.sortable is not a function
    at init.onadd (GridFieldExtensions.js?m=1519162305:422)
    at one (jquery.entwine-dist.js?m=1517459587:1011)
    at Array.<anonymous> (jquery.entwine-dist.js?m=1517459587:2095)
    at HTMLDocument.<anonymous> (jquery.entwine-dist.js?m=1517459587:2131)
    at HTMLDocument.dispatch (jquery.js?m=1517459587:3332)
    at HTMLDocument.eventHandle (jquery.js?m=1517459587:2941)
    at Object.trigger (jquery.js?m=1517459587:3210)
    at init.triggerHandler (jquery.js?m=1517459587:3874)
    at HTMLDocument.<anonymous> (jquery.entwine-dist.js?m=1517459587:1298)
    at fire (jquery.js?m=1517459587:1075)
@robbieaverill
Copy link
Contributor

Can you please provide the version of gridfieldextensions you're using?

@chtombleson
Copy link
Author

Im using version 3.1.1

@raissanorth
Copy link

raissanorth commented Mar 5, 2018

I looked into this using version 3.1.1 and closely following the sample provided in https://github.com/symbiote/silverstripe-gridfieldextensions/blob/master/docs/en/index.md#orderable-rows. It works as expected without any jQuery errors arising.

I will close this issue for now, but please feel free to open it again @chtombleson with details on how to reproduce it, if it's still an issue for you, thanks.

@robbieaverill
Copy link
Contributor

Reproduced using:

silverstripe/cms                          4.1.x-dev 7dea009
silverstripe/userforms                    dev-master e041c48
symbiote/silverstripe-gridfieldextensions 3.1.1 

I've created a userform page with two page breaks and a variety of fields. I've added a radio group field to the second page, and going in to edit that field triggers this error on the Options tab.

@robbieaverill
Copy link
Contributor

Can't reproduce any more. This seems to be reliant on something in the global state to reproduce

@sanderha
Copy link

sanderha commented Apr 17, 2018

I'm getting this error too. Also getting a similar error when using GridFieldEditableColumns and GridFieldAddNewInlineButton :

Uncaught TypeError: this.getGridField is not a function
    at init.onclick (GridFieldExtensions.js?m=1518386927:206)
    at one (jquery.entwine-dist.js?m=1523535699:1011)
    at HTMLDocument.prxy (jquery.entwine-dist.js?m=1523535699:1504)
    at HTMLDocument.dispatch (jquery.js?m=1523535699:3332)
    at HTMLDocument.eventHandle (jquery.js?m=1523535699:2941)

Also using ss4.1 and gridfield extensions 3.1.1.

Happens when clicking the Add button.

@wernerkrauss
Copy link

Ran into this issue today. I checked which modules are installed and tried some modifications; Even https://github.com/UndefinedOffset/SortableGridField throws a JS error.

It seems like jonom/silverstripe-text-target-length breaks some things. After disabling it gridsorting worked fine again.

@robbieaverill
Copy link
Contributor

For what it’s worth I’ve experienced this in an environment without that module in it

@sanderha
Copy link

@wernerkrauss Disabled jonoms module and GridFieldEditableColumns also works again.

However it seems Orderable Rows doesnt save to my manymanyExtraFields atm...

@SUTHERLANDesign
Copy link

@robbieaverill I'm using the SS4.1.0, UserForm 5.1.1 and GridfieldExtensions 3.1.1, still not working when selecting the 'Add' button in the Options tab for dropdown, checkbox and radio fields. Am i doing something wrong? is there something i've missed?

@robbieaverill
Copy link
Contributor

@buffy999 you aren't doing anything wrong. Hopefully this will get fixed soon 😄 we had a hard time reproducing it consistently while testing a while ago

@SUTHERLANDesign
Copy link

@robbieaverill, Just want to follow up on this one, i know you are busy with other issues. When will this be fixed? :)

@a2nt
Copy link

a2nt commented May 27, 2018

Here's the bug fix: jonom/silverstripe-text-target-length#17

@robbieaverill
Copy link
Contributor

@a2nt do you think that this bug only occurs when using that module?

@a2nt
Copy link

a2nt commented May 28, 2018

@robbieaverill well I have a lot of modules installed and the only issue I have found was silvestripe-text-target-length. Also it's clear that SS CMS bundles jquery, jquery.ui (sortable function), entwine into /resources/vendor/silverstripe/admin/client/dist/js/vendor.js and extra module specific js files.

So the CMS requires vendor.js with jquery.ui and the other stuff.
After that silvestripe-text-target-length requires jquery + entwine (only) again and overwrites jquery object.
After that there's no jquery-ui sortable function defined

It's silvestripe-text-target-length specific bug which will break any module that will use jquery.ui or will extend jquery functionality before silvestripe-text-target-length will be loaded

axllent/silverstripe-bootstrap-forms              2.0.2              An extension to add CSS classes to Sil...
axllent/silverstripe-version-truncator            2.0.3              Automatically delete old SiteTree page...
colymba/gridfield-bulk-editing-tools              3.0.0-beta4        SilverStripe GridField component to up...
composer/ca-bundle                                1.1.1              Lets you find a path to the system CA ...
composer/installers                               v1.5.0             A multi-framework Composer library ins...
dnadesign/silverstripe-elemental                  2.x-dev 66eedd8    Elemental pagetype and collection of E...
dnadesign/silverstripe-elemental-list             1.0.0              Adds a new element for nested elements
dnadesign/silverstripe-elemental-userforms        1.0.0              Adds a new element for usersforms
dnadesign/silverstripe-elemental-virtual          dev-master 4ba21c5 Adds ability for Elemental to share co...
doctrine/instantiator                             1.1.0              A small, lightweight utility to instan...
drmartingonzo/ss-tinymce-charcount                1.0.0              Plugin for tinyMCE in siverstripe to c...
dynamic/flexslider                                3.0.0-beta1        Display a FlexSlider on pages of your ...
dynamic/silverstripe-elemental-accordion          1.0.0-beta1        Display content in collapsable panels
dynamic/silverstripe-elemental-baseobject         dev-master 9d007e6 A simple base DataObject to use with E...
dynamic/silverstripe-elemental-blocks             2.0.0-beta1        A recipe to require additonal elements...
dynamic/silverstripe-elemental-blog               dev-master e40c6e1 A blog element for the SilverStripe El...
dynamic/silverstripe-elemental-countdown          1.0.0-alpha1       Additional count down element for the ...
dynamic/silverstripe-elemental-customer-service   1.0.0-beta1        Additional customer service element fo...
dynamic/silverstripe-elemental-embedded-code      1.0.0-beta1        A block to embed code like iFrames or ...
dynamic/silverstripe-elemental-features           1.0.0-alpha2       A block that displays featured content...
dynamic/silverstripe-elemental-flexslider         1.0.0-beta4        Flexslider slideshow content block for...
dynamic/silverstripe-elemental-gallery            1.0.0-alpha2       A block to display a collection of images
dynamic/silverstripe-elemental-image              1.0.0-alpha1       A block to add a single image to your ...
dynamic/silverstripe-elemental-oembed             1.0.0-alpha2       A block to embed media from other webs...
dynamic/silverstripe-elemental-promos             1.0.0-alpha1       A block to display a group of promo ob...
dynamic/silverstripe-elemental-section-navigation 1.0.0-alpha1       A block to display a list of links to ...
dynamic/silverstripe-elemental-sponsors           1.0.0-beta2        A sponsors element for the SilverStrip...
dynamic/silverstripe-elemental-testimonials       1.0.0-beta1        Testimonials element for the SilverStr...
dynamic/silverstripe-geocoder                     dev-master 381fcb8 SilverStripe wrapper for Geocoder
egeloen/http-adapter                              0.8.0              Issue HTTP request for PHP 5.3+.
embed/embed                                       v3.3.2             PHP library to retrieve page info usin...
firesphere/googlemapsfield                        dev-master ecf39a4 Google places api field for SilverStripe
gorriecoe/silverstripe-dataobjecthistory          1.2.2              Adds a history tab to dataobjects
guzzlehttp/psr7                                   1.4.2              PSR-7 message implementation that also...
hestec/silverstripe-cookiebar                     1.0.0              CookieBAR EU for SilverStripe
igorw/get-in                                      v1.0.3             Functions for for hash map (assoc arra...
intervention/image                                2.4.1              Image handling and manipulation librar...
jonom/silverstripe-betternavigator                4.1.1              Front-end utility menu for SilverStrip...
jonom/silverstripe-text-target-length             2.0.1              Set character length recommendations o...
league/flysystem                                  1.0.45             Filesystem abstraction: Many filesyste...
m1/env                                            2.1.1              Env is a lightweight library bringing ...
mak001/silverstripe-categorization                dev-master 79dfb26 SilverStripe Categorization Module. Ea...
marcj/topsort                                     1.1.0              High-Performance TopSort/Dependency re...
monolog/monolog                                   1.23.0             Sends your logs to files, sockets, inb...
myclabs/deep-copy                                 1.7.0              Create deep copies (clones) of your ob...
nikic/php-parser                                  v3.1.5             A PHP parser written in PHP
paragonie/random_compat                           v2.0.12            PHP 5.x polyfill for random_bytes() an...
phpdocumentor/reflection-common                   1.0.1              Common reflection classes used by phpd...
phpdocumentor/reflection-docblock                 4.3.0              With this component, a library can pro...
phpdocumentor/type-resolver                       0.4.0             
phpspec/prophecy                                  1.7.6              Highly opinionated mocking framework f...
phpunit/php-code-coverage                         4.0.8              Library that provides collection, proc...
phpunit/php-file-iterator                         1.4.5              FilterIterator implementation that fil...
phpunit/php-text-template                         1.2.1              Simple template engine.
phpunit/php-timer                                 1.0.9              Utility class for timing
phpunit/php-token-stream                          2.0.2              Wrapper around PHP's tokenizer extension.
phpunit/phpunit                                   5.7.27             The PHP Unit Testing framework.
phpunit/phpunit-mock-objects                      3.4.4              Mock Object library for PHPUnit
psr/cache                                         1.0.1              Common interface for caching libraries
psr/container                                     1.0.0              Common Container Interface (PHP FIG PS...
psr/http-message                                  1.0.1              Common interface for HTTP messages
psr/log                                           1.0.2              Common interface for logging libraries
psr/simple-cache                                  1.0.1              Common interfaces for simple caching
sebastian/code-unit-reverse-lookup                1.0.1              Looks up which function or method a li...
sebastian/comparator                              1.2.4              Provides the functionality to compare ...
sebastian/diff                                    1.4.3              Diff implementation
sebastian/environment                             2.0.0              Provides functionality to handle HHVM/...
sebastian/exporter                                2.0.0              Provides the functionality to export P...
sebastian/global-state                            1.1.1              Snapshotting of global state
sebastian/object-enumerator                       2.0.1              Traverses array structures and object ...
sebastian/recursion-context                       2.0.0              Provides functionality to recursively ...
sebastian/resource-operations                     1.0.0              Provides a list of PHP built-in functi...
sebastian/version                                 2.0.1              Library that helps with managing the v...
sheadawson/silverstripe-linkable                  dev-master 8867381 A couple of handy form fields and obje...
silverstripe/admin                                1.1.0              SilverStripe admin interface
silverstripe/asset-admin                          1.1.0              Asset management for the SilverStripe CMS
silverstripe/assets                               1.1.0              SilverStripe Assets component
silverstripe/blog                                 3.1.0              A fresh take on blogging in Silverstri...
silverstripe/campaign-admin                       1.1.0              SilverStripe campaign admin interface
silverstripe/cms                                  4.1.0              The SilverStripe Content Management Sy...
silverstripe/config                               1.0.4              SilverStripe configuration based on YA...
silverstripe/errorpage                            1.1.0              ErrorPage component for SilverStripe CMS
silverstripe/externallinks                        2.0.2              Adds tracking of broken external links...
silverstripe/framework                            4.1.0              The SilverStripe framework
silverstripe/graphql                              1.1.0              GraphQL server for SilverStripe models...
silverstripe/lumberjack                           2.0.0-rc1          A module to make managing pages in a G...
silverstripe/recaptcha                            dev-master 6c839da Provides a form field which allows for...
silverstripe/recipe-cms                           1.1.0              SilverStripe recipe for fully featured...
silverstripe/recipe-core                          1.1.0              SilverStripe framework-only core recipe
silverstripe/recipe-plugin                        1.2.0              Helper plugin to install SilverStripe ...
silverstripe/redirectedurls                       dev-master 042ece4 Provides a system for users to configu...
silverstripe/reports                              4.1.0              Reports module for SilverStripe CMS
silverstripe/segment-field                        2.2.1              A reusable approach to segment-generat...
silverstripe/siteconfig                           4.1.0              Site wide settings administration.
silverstripe/spamprotection                       3.0.0              Spam protection module for SilverStripe.
silverstripe/tagfield                             2.0.0              Tag field for Silverstripe
silverstripe/userforms                            5.1.1              UserForms enables CMS users to create ...
silverstripe/vendor-plugin                        1.3.3              Allows vendor modules to expose direct...
silverstripe/versioned                            1.1.0              SilverStripe Versioned component
sunra/php-simple-html-dom-parser                  v1.5.2             Composer adaptation of: A HTML DOM par...
swiftmailer/swiftmailer                           v5.4.9             Swiftmailer, free feature-rich PHP mailer
symbiote/silverstripe-gridfieldextensions         3.1.1              A collection of useful grid field comp...
symfony/cache                                     v3.4.11            Symfony Cache component with PSR-6, PS...
symfony/config                                    v3.4.11            Symfony Config Component
symfony/filesystem                                v4.0.11            Symfony Filesystem Component
symfony/finder                                    v3.4.11            Symfony Finder Component
symfony/polyfill-apcu                             v1.8.0             Symfony polyfill backporting apcu_* fu...
symfony/polyfill-ctype                            v1.8.0             Symfony polyfill for ctype functions
symfony/polyfill-mbstring                         v1.8.0             Symfony polyfill for the Mbstring exte...
symfony/translation                               v2.8.41            Symfony Translation Component
symfony/yaml                                      v3.4.11            Symfony Yaml Component
unclecheese/display-logic                         2.0.1              Allows assignment of conditions for di...
undefinedoffset/sortablegridfield                 2.0.4              Adds drag and drop functionality to Si...
vulcandigital/silverstripe-seo                    1.0.0              An all-in-one SEO module for SilverStripe
webmozart/assert                                  1.3.0              Assertions to validate method input/ou...
webonyx/graphql-php                               v0.8.0             A PHP port of GraphQL reference implem...
willdurand/geocoder                               v3.3.0             The almost missing Geocoder PHP 5.4 li...
wilr/silverstripe-googlesitemaps                  2.1.2              SilverStripe support for the Google Si...
zendframework/zend-diactoros                      1.7.1              PSR HTTP Message implementations

@jonom
Copy link
Contributor

jonom commented May 28, 2018

I've merged @a2nt's fix in to silverstripe-text-target-length. It sounds like other modules may have the same issue, so if you're experiencing this problem without text-target-length installed maybe try searching for lines like this in your installed modules:

Requirements::javascript('silverstripe/admin:thirdparty/jquery/jquery.js');
Requirements::javascript('silverstripe/admin:thirdparty/jquery-entwine/dist/jquery.entwine-dist.js');

@jonom
Copy link
Contributor

jonom commented May 28, 2018

I don't know what the build/dist process is like for JS in SilverStripe core, but it would be cool if the Requirements API could recognise that a JS file had been bundled and shouldn't be included again if requested subsequently.

@a2nt
Copy link

a2nt commented May 29, 2018

@jonom I think it will be nice to have an option to bundle all modules into one CMS js file using composer script. Just like vendor-expose, but with bundling option

@ScopeyNZ
Copy link
Contributor

ScopeyNZ commented Jun 1, 2018

I've spent a while trying to reproduce this issue using all the combinations given here. Still haven't had any success reproducing it. I'm closing this issue as it seems as though people have had some success disabling or fixing bugs in other modules so it's not apparent the issue is with this module.

If this is still happening for you, and a clear cache (Windows: ctrl-f5 or Mac: ⌘-shift-R) does not resolve the issue then please let us know what modules you have installed (copy the output of composer show) and any javascript errors that your browser reports.

@ScopeyNZ ScopeyNZ closed this as completed Jun 1, 2018
@elliot-sawyer
Copy link

I'm getting this issue on CWP 4.2.1 (on silverstripe/userforms 5.2.1, and tried on 5.2.2). I don't have jonom/silverstripe-text-target-length installed. What other modules should I try to disable?

Steps to reproduce:

  • create a userform
  • add a DropdownField to the form
  • click the Options tab
  • try to add a value

@elliot-sawyer
Copy link

CheckboxSetField and RadioGroup seem to be unaffected.

@robbieaverill robbieaverill reopened this Nov 16, 2018
@robbieaverill
Copy link
Contributor

This keeps coming up, so I'm going to reopen it.

There are some decent steps to reproduce it here, which will hopefully help.

@robbieaverill
Copy link
Contributor

Can someone please re-test with the latest version of silverstripe/admin? (1.3.3 I think). There was a change made in how SilverStripe handles loading a chain of JavaScript files - previously if one had dodgy content it would stop loading the rest of the files, where it now ignores it and continues through the rest of the chain.

@Leapfrognz
Copy link

Leapfrognz commented Apr 2, 2019

I got the same error just now on CWP 2.2.0, SS 4.3.0, Userforms 5.3.0, GridfieldExtensions 3.2.1
No text-target-length installed.
Jonom's reply helped, and I found jquery and entwine in Silvershop/silverstripe-hasonefield was the culprit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests