json-schema-form / angular-schema-form

Generate forms from a JSON schema, with AngularJS!
https://json-schema-form.github.io/angular-schema-form
MIT License
2.47k stars 653 forks source link

Issue in adding multiselect input field as addon into schema form #756

Closed SureshArav closed 8 years ago

SureshArav commented 8 years ago

Enhancement

I have added the following multiselect input field into schema form lib

http://dotansimha.github.io/angularjs-dropdown-multiselect/#/

Expected behaviour

This multiselect fields dropdown will be open till the use selects the value and close it manually

Actual behaviour

But after adding it to schema form lib on single select itself the dropdown gets closed,since iam triggering a broadcast event to redraw schema form after selection of fields

Gist/Plunker/Demo

https://plnkr.co/edit/QEP5s6zaG0Kgdbqi14DE?p=preview

Related issues

This is/maybe related to ...

@json-schema-form/angular-schema-form-lead

nicklasb commented 8 years ago

I don't understand. The problem is, as you say, that you are broadcasting a redraw. That will trigger a redraw, which means that your dropdown will be redrawn, and I would presume that its initial state would be closed.

The problem is that you are redrawing schema form. Don't do that if you need to keep the states of active editors.

The plunkr doesn't seem to work, so I cannot see what you are trying to do, I am afraid.

SureshArav commented 8 years ago

Hi nicklasb, Thanks for your response Here is the working plunkr http://plnkr.co/edit/DpHgwshltP1INId4fdoh?p=preview

UI will have two multiselect dropdowns. Based on 1st dropdowns selection 2nd dropdown will gets populated.For this data population i'm trying to redraw the schema form. Because after data selection from 1st dropdown scope is getting updated with 2nd dropdown's options but data is not getting populated into 2nd drop down . After redrawing schema form for each selection, dropdown is getting closed.Being a multiselect input field,it should be open till the user picks multiple options.

Please comment asap and ask questions if my requirements are not clear

nicklasb commented 8 years ago

Are you sure you need to redraw the schema?

Anyway, a simpler solution is to use the add-on I am maintaining, angular-schema-form-dynamic-select, it has a filter functionality that acts that way, or you can use the onChange event: https://github.com/OptimalBPM/angular-schema-form-dynamic-select#filters

SureshArav commented 8 years ago

Hi nicklasb

onChange is not working with multiselect input field.But its working with all other default html input fields. we need to use multiselect directive only,since its our requirement is it possible to redraw schema form on close of dropdown? i have tried to trigger redraw event on close of multiselect drop down,but its not getting triggered.

Let me know is there any other way to achieve this task

nicklasb commented 8 years ago

onChange not working? Multiselect seems to have an onChange, I would recommend that you, during initialization, map whatever callback is set in options to that: http://davidstutz.github.io/bootstrap-multiselect/#configuration-options-onChange

ASF cannot guess what callbacks a completely external component has, you have to map those explicitly. Same thing with CSS-parameters and so on.

Anthropic commented 8 years ago

Due to a month without response I am closing. Please re-open if you do not feel the question has been answered sufficiently.