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

NINSUO Symfony Collection Crashes after 100 Records #127

Open
ghost opened this issue May 8, 2018 · 4 comments
Open

NINSUO Symfony Collection Crashes after 100 Records #127

ghost opened this issue May 8, 2018 · 4 comments

Comments

@ghost
Copy link

ghost commented May 8, 2018

I'm doing an asset management system and during the testing phase, the tester reported that she couldn't add any assets to a person anymore once the asset count reaches 100. I tried raising the max to 1000 to no avail. Upon closer look, it seems that the javascript itself crash causing the control buttons to not appear. These include the add and delete button.
Uncaught RangeError: Maximum call stack size exceeded at r.fn.init.push (<anonymous>) at ga.select (jQuery.js:2) at Function.ga [as find] (jQuery.js:2) at r.fn.init.find (jQuery.js:2) at HTMLDivElement.<anonymous> (jquery.collection.js:735) at Function.each (jQuery.js:2) at r.fn.init.each (jQuery.js:2) at String.<anonymous> (jquery.collection.js:730) at Function.each (jQuery.js:2) at setRightPrefix (jquery.collection.js:728)

@ninsuo
Copy link
Owner

ninsuo commented May 8, 2018

Hey there,

Set max: 999 so the maximum elements won't be reached, there must be a bug with max option.

Cheers,
Alain

@ghost
Copy link
Author

ghost commented May 9, 2018

Nope still won't work, maybe I'm doing something wrong here:

        $('.asset_collection').collection({ allow_duplicate: false,
                                            allow_up: false,
                                            allow_down: false,
                                            max: 999,
                                            add_at_the_end: true,
                                            up: '<a href="#" class="btn btn-primary with-margin"><i class="fas fa-chevron-up"></i></a>',
                                            down: '<a href="#" class="btn btn-primary with-margin"><i class="fas fa-chevron-down"></i></a>',
                                            add: '<a href="#" class="btn btn-primary with-margin"><i class="fas fa-plus"></i></a>',
                                            remove: '<a href="#" class="btn btn-danger with-margin"><i class="fas fa-trash-alt"></i></a>',
                                            duplicate: '<a href="#" class="btn btn-primary with-margin"><i class="fas fa-copy"></i></a>'
        });

@ninsuo
Copy link
Owner

ninsuo commented May 9, 2018

Okey, there may be an issue with recursions when there are too many children.

You can eventually use a hidden position field in your entity instead, because much less code is executed.

See the example here: https://symfony-collection.fuz.org/symfony3/basic/positionField

A

@jkabat
Copy link

jkabat commented Jul 3, 2018

@Horzta Please make sure it is not PHP issue - I have not tried symfony-collection yet, but I've dealt with similar issue in the past.

If your FORM is broken you should probably check max-input-vars INI setting.

http://php.net/manual/en/info.configuration.php#ini.max-input-vars

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

No branches or pull requests

2 participants