In my earlier enhancement of sliders, I created a Javascript list of values for each slider, which would update while the slider is being manipulated. It worked very well at first, but then resulted in a problem: SAGE truncated the array when it was too big which resulted in a Javascript error and nothing worked. In this I responded to 2 patches: pruning the array of values and removing truncation, since other people were complaining about it as well.
Since removing the truncation, I was able to create selectors with a lot of values, say, 10000.
def _(a=[1..10000]):But they loaded very slowly because the SAGE server was rendering 10000 lines of
<option value='n' >n</option>What if the server instead returned more Javascript? Then the code would look like this:
var values=[1, 2, ..., 10000];
for(var i in values)
//code to generate a select option
Which means a lot less text being generated by the server. Of course, the optimal return is
for(var i=1; i<=10000; i+=1)
//code to generate a select option
But this involves detecting the range which may or may not be possible depending on the underlying structure.

No comments:
Post a Comment