-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"EmbAJAXOptionSelect<3>" dynamic list possible ? #37
Comments
No problem. This is not currently possible. As a matter of fact, allowing dynamic lists (also at other places in the lib) is something I intend to add. I have begun working on that a bit (branch non_template_container), but allowing that without increasing flash and ram usage for static lists is still giving me a bit of a headache. So, in fact, an EmbAJAXScriptedSpan will be your best bet for the time being. Thinking about it right now, I suppose it may make sense to create a separate class EmbAJAXDynamicOptionSelect. Maybe I'll find some time to give that a try over the weekend. Regards |
Thomas, |
All right. Allowing for a dynamic option list seemed like quite a separate problem, after all. Here's a first shot at this. It still has a lot more quick-and-dirty hacks in it that I would like. Among other things, it will simply discard any quotes of backslashes in the labels. The advantage of this initial solution is that this is a stand-alone class that you can start using right away, without any other changes in the lib. Let me know, what you find missing, then I can look into merging your feedback into a final solution. That is still going to remain a separate class from the more lightweight EmbAJAXOptionSelect, although the name "EmbAJAXOptionSelect2" should probably still be replaced, too. Long story short: Copy the following into your sketch. I hope usage is self-explanatory, otherwise, ask.
|
First of all, thank you very much for your effort. For example: EmbAJAXScriptedSpan test_script("test_script","document.write('<select id="Ultra" onchange="test()"……….….‘);test function () {alert("HelloWorld");this.sendValue('hello');}",test_script_buf,BUFLEN); Unfortunately, the function test() is not called in the script, so you cannot assign the test_script_buf. As I have already indicated, I am far away from C++, so that I am already failing to call your class correctly. An example call would be very helpful. My data is generated as follows String WIFI_AP_LIST[WIFI_AP_LIST_MAX]; uint8_t wifi_counter; n = WiFi.scanNetworks(); for (i = 0; i < n; ++i)
} Thanks again for your effort, sorry for my incompetence Have a nice day |
As to your javascript attempt, I think the problem is here:
should be:
Untested:
|
Sorry to bother you again.
const char* radio_opts[] = {"option1", "option2", "option3"};
EmbAJAXOptionSelect<3> optionselect("optionselect", radio_opts);
EmbAJAXMutableSpan optionselect_d("optionselect_d");
I would like to be able to use EmbAJAXOptionSelect to output my SSID list, which I got from a WiFi.scanNetworks(); and select the appropriate entry.
Of course I can solve this by generating a JavaSript dynamically and then outputting it with EmbAJAXScriptedSpan.
But maybe there is a more elegant way with your lib.
Thanks in advance
With best regards
Siegmar
The text was updated successfully, but these errors were encountered: