If the selected value of a data-linked <select> is set prior to adding options, selection is not always established correctly
Closed this issue · 3 comments
(Sorry for the poor title)
I have a tag that is using linkedElement.
The selected value is set before the actual values are available. After the values are rendered I'm expecting the select element to have it's value set to the selected value.
Here is a fiddle to demonstrate the issue.
The tag t1 has a data-link attribute set manually while the tag t2 uses linkedElement.
If the values are available before the tag renders then it work correctly.
I followed the code and this method in jquery.views.js is called:
function bindDataLinkTarget(linkCtx, late) {
...
if (linkCtx.elem.nodeName === "SELECT" && linkCtxType === "link" && !linkCtx.attr
&& linkCtx.convert !== undefined) {
linkCtx doesn't have the convert property and so it does not go into the if statement.
Thanks for calling this out. On investigation I found that there are also some related issues on other slightly different scenarios involving data-linking on <select>
elements. Here is a proposed update which should address those cases, as well as this bug.
Let me know if it works for you...
I'm happy to inform you that it works like a charm!
Thanks
Resolved in v1.0.8