Testing... I'll update.
Testing... I'll update.
Could you please give us a public link to your app? We can't reproduce the problem.
I narrowed it down a bit. It seems that the problem does not occur on the Appery('list').empty() itself , but afterwards when the list is populated from a service mapping.
If I DON'T do the Appery('list').empty() first, then there is no problem and the list shows without error.
If I do a Appery('list').empty() BEFORE executing the service that maps to the list, then the error is there!
Yes, now I am sure there is an bug.
I reproduced the error on a complete blank page with just 1 selectmenu and 1 service. The service response is mapped to the selectmenu.
On the page show event: do Appery('list').empty()
Then another page show event: invoke the service. (make sure the invoke service event is AFTER the Appery('list').empty())
You will see that the error is there.
There is no error if you do a .empty() in the success event of the service, of if you do a .empty() without invoking the service that is mapped to the selectmenu.
Since I had the error also with a list, I suspect that lists AND selectmenus are susceptible to this bug.
If you discover the bug, could you please think of a workaround, because the empty() list before the service invoke is critical to my app...
Be sure, we will let you know asap.
Hello! It's not a bug. You need to map parameters to some components. For Select there is an empty option code<option value="" rerender="mobileselectmenuName" dsid="mobileselectmenuName-0" data-placeholder="true"></option>/code.
In List there is a hidden item, based on this item new items create when you map. You can save these hidden elements on page Show event (for example in localStorage). Then after empty() add saved elements, for example for Select if it's empty at the beginning. On page Show run JS:
codevar defaultOptionFormobileselectmenuName = Appery("mobileselectmenuName").html();
localStorage.setItem("defaultOptionFormobileselectmenuName", defaultOptionFormobileselectmenuName);/code
After codeAppery("mobileselectmenuName").empty();/code should be added codeAppery("mobileselectmenuName").append(localStorage.getItem("defaultOptionFormobileselectmenuName"));/code
Then why is it working when, after an empty() , I manually append options, but it is not working when the selectmenu is mapped to from a service afterwards?
I cannot use your Appery('mobileselectmenuName').html() because sometimes the list has already real values, which is the exact reason why I want to use the empty() ...
How can I select this hidden element when the list already has real values? Because Appery('listname').children(':first') gives me the first REAL child, not the hidden element option.
Furthermore, I did what you suggested for the LIST. On first page load I do:
localStorage.setItem("listItemStart", "Appery('list').html());
Then further I do: Appery('list').empty(); Appery('list'). append(localStorage.getItem("listItemStart"));
Then service.execute, as normal.
On the page, the list is not showing. But I can see in the source html that all list items are there, but they have a display:none , just as the template hidden 1st item used to have.
Any ideas?