umco / umbraco-nested-content

Nested Content for Umbraco 7.1 to 7.6
https://our.umbraco.org/projects/backoffice-extensions/nested-content
MIT License
45 stars 35 forks source link

Dropdown List (not multiple) become unselected at 'Unpublish' and the very first `Publish` #92

Closed jaypeng2015 closed 7 years ago

jaypeng2015 commented 7 years ago

I recently used Dropdown List (not multiple) in the nested content.

Umbraco Version: v7.5.3 Nested Content Version: v0.3.0

In short, if I want to keep the selected value, I have to publish the document at least twice.

Here are the details:

The dropdown is very simple and the values look like (from table [cmsDataTypePreValues]):

id          datatypeNodeId               value    sortorder     alias
138          1072                                 yes        1                  0
139          1073                                  no         2                 1

Then I created a document with this dropdown within a nested content component.

At last I added a breakpoints to the NestedContentPropertyEditorController, line 67 (var inited = false;), and I found that after 'Unpublish' and the very first Publish, what gets into scope.model.value when refreshing the page is the string value (e.g. 'yes'), but in other situations this gets the database record id (e.g. ). Also I have compared the database value in sqlserver, there's no difference between the first publish and second one. However, I couldn't dig any deeper.

How can this be fixed?

mattbrailsford commented 7 years ago

Unable to replicate, or fixed by another commit. Please retest with latest nightly and provide additional info if the problem remains. Closing issue for now.

jaypeng2015 commented 7 years ago

I can't provider more info in addition to this. Still suffering from this and unfortunately we can't use a nightly version for production. May I ask when will you release the next version? @mattbrailsford

leekelleher commented 7 years ago

@jaypeng2015 - just to let you know that we finally have a new release 😼 https://github.com/umco/umbraco-nested-content/releases/tag/0.4.0

jaypeng2015 commented 7 years ago

@leekelleher @mattbrailsford Good news!

Just tested it this morning with Umbraco v7.5.3, but unfortunately the problem is still there. After 'Unpublish' and the very first Publish, NestedContentPropertyEditorController still gets wrong value into model.value (string 'yes', should be the prevalue id like '138')

id          datatypeNodeId               value    sortorder     alias
138          1072                          yes        1              0
139          1073                          no         2              1

No idea how the value was put into the model, but the controller did get the value in different ways.

Here I got some screenshot of another example. I have a single dropdown called alignment which has values: Right, Left and Centre, then I put it into a nested content component.

The model value of alignment after save is 115: image

The model value when refreshing the page after first publish is Right, which can not be displayed on the page: image

However, after the second publish, no matter how many times you refresh the page, the value will always be 115.

joannaz commented 6 years ago

@jaypeng2015 Sorry for necroing an old issue, but did you ever get this fixed? I'm experiencing a similar issue (but my dropdown box will always get emptied whatever I do as the prevalue id returns the actual value instead of the id!) and was wondering if you found a workaround/fix.

I have opened an issue with the Umbraco guys: http://issues.umbraco.org/issue/U4-11089 but it seems like quite a niche bug as I can't seem to reproduce it in a new Umbraco project :(