Open KiSchulte opened 6 years ago
Ok, I had a deeper look into the topic. Seems that this will not work at all at the moment. As there is no information about the added array Elements in the schemaMap, there is no possibility to address the certain array element. Which results in the issue that for cleanData the id of the array is given and therefore all array elements are cleaned up on dependencyChange and not only the actual chosen one. The only solution I see here, to fix this, is to integrate array Elements in the schemaMap and add the id in the input.
I'm in the same boat here...
I altered onDependencyChanged to add the source variable to the shemaresolver output, but it's pretty useless. the source element ID doesn't reflect the heirarchy of the data attributes.
Hi,
I've created a Form with couple of array's. One of them has three dropdown where the second depends on the first and the third on the second. I've created a resolver for this to get the right values for the dropdowns from a existing hierarchical object with three dimensions. This is working like expected so far. But the datastore is not updated like it should.
After I added the first item in the array, all three values are present in the datastore if I check them with getData(). Then with adding the next item, the issue starts. After adding the item to the array the previous entry in the datastore has no property two and three anymore, booth are deleted by adding the next item to the array.
First item added:
{ "gender": "Female", "services": [ { "category": "Beauty & Wellness", "service": "Beauty Salon", "specialization": "Nail Salon" } ] }
Next Item added
{ "gender": "Female", "services": [ { "category": "Beauty & Wellness" }, { "category": "Beauty & Wellness", "service": "Hairdresser" } ] }
And this repeats on every adding. Only the last added item has the properties two and three the previous one are losing the properties.
Here is my resolver: ` const resolver = function(names, data, cb) { let schemas = []; let schema = [];
`
This resolver handles booth dropdown dependencies. I tried already to use the selector '$.services[$].service' instead of '$.services[#].service', so I thought this will just catch the last element in the array, but with this the dependencies are not builded correctly anymore.
I hope I can manage to set up a jsfiddle environment with the whole setting, so it will be easier to check it. Maybe it's also a problem in my resolver, maybe I set a wrong schema here?
Any help will be appreciated.
cheers