mcintyre321 / FormFactory

MVC5, Core or standalone - Generate rich HTML5 forms from your ViewModels, or build them programatically
http://formfactoryaspmvc.azurewebsites.net/
MIT License
304 stars 102 forks source link

Nested ICollection change #62

Closed reiphil closed 6 years ago

reiphil commented 6 years ago

Pulled in changes from pull request 34 to allow for nested icollections.

The change affects the .js file and how it works with the icollection property. The ICollection property will loop on containers. This allows for nested collections.

The change may need to be corrected based on original feedback of change in the JS (encoded html vs script tag).

mcintyre321 commented 6 years ago

Can you check if drag n drop reordering still works on the collections?

reiphil commented 6 years ago

Drag and drop reordering works on non nested collections. If the collection is nested and needs the multiple outer form collections, the drag and drop reordering does not work. I suspect the drag and drop reordering is targeting specific class names? I can look into adjusting it for nested collections if needed.

In short: Drag and drop still works as before but does not work on the new nesting.

reiphil commented 6 years ago

Actually - upon further testing. Prepopulated objects drag just fine. Added items do not drag, and this is not a bug from the code but an existing issue it appears.

Try this on the EditableCollectionsExample - add a new movie and try to drag it, it does not drag.

There should be an adjustment on newObject in the .ff-add-item. add draggable and id. Will test further.

reiphil commented 6 years ago

Summary - upon testing drag/drop it was found that new items were not draggable. Nested collections were draggable as long as they were already defined (the template adds the draggable true attribute to predefined objects).

Adding a new item in the .js does not add draggable true or assign a random id to it. After adding that to the call in the .js, new items are draggable immediately, in both nested and non nested collections.

mcintyre321 commented 6 years ago

Awesome work, thanks!

mcintyre321 commented 6 years ago

It looks like the line using System.Text.Encodings.Web; in the ICollection cshtml template has broken the demo site - is this necessary?

reiphil commented 6 years ago

With how the previous dev was doing it, he was encoding the piece to an html string then decoding it in the JS so it is necessary. is that library not available? On my demo machine, I have the page working just fine and used it to verify changes.