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

Advice for making strapselect work better inside an array with the new bootstrap decorator #63

Open
mpina83 opened this issue Nov 20, 2015 · 12 comments
Labels

Comments

@mpina83
Copy link

mpina83 commented Nov 20, 2015

I've upgraded to the recomended ASF bootstrap Decorator ( https://github.com/Textalk/angular-schema-form-bootstrap ) because of some issues working inside arrays and the destroyStrategy. Now the strapselect boxes dont render inside an array if we have more then one or dont work properly if i«ve just one(doesnt write the values in the model).

If i pick one standard select box and one strapselect the form will render but the filterTriggering stops working because it wont parse the arrayIndex value and thus the functionality of having two chained select boxes populating B values depending on select A values breaks.

Bellow i will link 2 plunker demos one working with the default ASF bootstrap decorator:

http://plnkr.co/edit/Ttxb3Icql42U8v3UrlIM?p=preview

and the last one not working with the recommended ASF bootstrap decorator:

http://plnkr.co/edit/xOlkiP7iN5vYekc7Kr8i?p=preview

ps:. you can switch the first strapselect type to just select to see the form rendering but it will still not get the triggers like it should.

It's worth to mentions was having a big problem before using select boxes nested inside array and this fix mentions here:
json-schema-form/angular-schema-form#590
(props to elbunuelo)

Solved some issued until now at least with the standard ASF select box.

@nicklasb
Copy link
Member

According to elbunuelo in the linked issue json-schema-form/angular-schema-form-bootstrap#9, this seems to be because of a problem in ASF.
Therefore I am not sure if there is anything I can do.

Anyway, there seems to be a workaround in there, so I'll leave this open for to spread the information.

Note: @davidlgj is on parental leave, I would be a bit careful with venturing into the unknown with the new decorator right now. Also, I tried ASFDS with the new decorator when deyceg released it, not sure why it doesn't work now.

@mpina83
Copy link
Author

mpina83 commented Nov 29, 2015

Hello thanks for the reply and maybe you can, altho elbueno workaround seems to be working atm the issue seems to be related with the new decorator builders from angular schema form bootstrap.
Bellow it's a schema-form.js quote:
" * DEPRECATED use defineAddOn() instead .

  • Adds a mapping to an existing decorator."

he's refering to the addMapping() the one ASF Dynamic select is using atm.

So i've applied elbueno workaround plus changed the dynamic select decorators with the new method, applied the new builder from angular-schema-form-bootstrap and changed the templates from the dynamic select to use the sf-field-model (replaces the ngmodel with the correct path) and everything seems to be working properly at least for now.

So if we had an oficial patch/branch to work with https://github.com/Textalk/angular-schema-form-bootstrap it would awesome since ASF seems to be heading that way.

And btw great job with ASF dynamic plugin!! :)

@nicklasb
Copy link
Member

Can't you create a fork of the bootstrap decorator with the fix and a PR? Then people can just use the fork meanwhile?

@mpina83
Copy link
Author

mpina83 commented Nov 29, 2015

i can send it to you tomorrow after i get to work, because i just applied the change to strapselect and uiselect and i dont know if i've broke the filterTriggers feature or any other stuff. thus it's not "stable" enough for ppl start using.

@nicklasb
Copy link
Member

Just create a fork and link to it from here, then people can make their own decisions.

@mpina83
Copy link
Author

mpina83 commented Nov 29, 2015

will do tomorrow since atm i dont have my working laptop with me

@mpina83
Copy link
Author

mpina83 commented Nov 30, 2015

hello again here it's the link:
https://github.com/mpina83/angular-schema-form-dynamic-select

to be able to save the modelValues inside a nestedArray we have to apply elbueno fix into schema-form.js.

And i only applied the workaround to uiSelect and strapselect templateCache

@nicklasb nicklasb changed the title strapselect not working well inside an array with the new recommended bootstrap Decorator Advice for making strapselect better inside an array with the new recommended bootstrap Decorator Feb 2, 2016
@nicklasb nicklasb changed the title Advice for making strapselect better inside an array with the new recommended bootstrap Decorator Advice for making strapselect work better inside an array with the new bootstrap decorator Feb 2, 2016
ri0t added a commit to Hackerfleet/angular-schema-form-dynamic-select that referenced this issue Apr 17, 2017
@davidsapiro
Copy link

If anyone is still looking at this issue ...
I need to get the multi-select working with the new bootstrap Decorator.

Thanks to mpina83 for doing this for uiselect and strapselect - I should have realised that this would not be trivial or I guess that it would have been done for everything? Happy to do a PR for this once I have it working - but before I do a deep dive (and a casual look has got me nowhere so far) is there something I am missing about the difficulty of doing this?
Thanks

@nicklasb
Copy link
Member

nicklasb commented Apr 6, 2018

I don't know, but please take a look if you can!

@anasofiapaixao
Copy link

I think I have stumbled upon one specific subset of this issue, even already with 0.8.14 which incorporates the fixes above, where selects are not rendered. It seems to me that the strapselect or the uiselect only work if they are the last and only one in the array. I have made a plunker exemplifying several situations: https://next.plnkr.co/plunk/wEXZs9SJ76AcFK6G

@nicklasb
Copy link
Member

nicklasb commented Dec 18, 2018 via email

@anasofiapaixao
Copy link

I'm thinking of looking into it once I have the time and energy; for now I hoped isolating these behaviours in a plunker could be of help (for finding the root cause or for people looking to workarounds)

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

No branches or pull requests

4 participants