Assuming I have a select like this:
<select size="4">
<option id="1">Please wait ...</option>
<option id="2">Please wait ...</option>
<option id="3">Please wait ...</option>
<option id="4">Please wait ...</option>
<option id="5">Please wait ...</option>
</select>
I should see a List of 4 elements having a scrollbar on the right.
What i like to do now is to load the text via ajax if the option becomes visible somehow (scrolling and/or initial).
EDIT:
At the end, I do not load them lazy because of the huge metadata transfer. This is the request I must upload (send to the server):
This is inacceptable for the lazy-load of single elements.
You can try this. It doesn't really use a select. It recreates its behaviour using JS. You should try out of jsfiddle since it has problem with http requests.
The handling for the ajax loaded elements is not working yet, it is easy to fix.
I'm sorry for my bad English, but as I'm understanding this question I can present this solution:
Link
Here's how you do it:
It will only load when the element is visible.
something like this might work for you, it basically just checks the option's offsets, but also makes sure you're not sending multiple ajax requests
see the JSFiddle here, it loads kind of fast, you could comment out the
triggerHandler
to prevent it sending requests on page loadedit: also i updated the ids of the option elements since ids shouldn't start with a number
You can pass the element/option to below funtion to check if the element is visible and to execute your AJAX function call.
Execution will be like