I am just wondering if there is any blocking method to bring the collection data from server.
I know I can use Collection’s fetch method – but it has an event handler ‘complete’ that is called at the time that fetch operation completes.
What I would like is a method that blocks until the fetch completes – is there anything like that?
There is no direct method as such. However, as options passed to fetch ends up passed to $.ajax, and you can pass async: false, which will make your ajax request blocking and synchronous. Synchronous ajax (well, not ajax, more like sjax) requests considered harmful, because they block page UI completely, but if you absolutely must, then god will probably not kill a kitten.
Better way is to shade a page with loader image and ask user to wait while you load her data.
Could not be clearer. Yeah, I actually shade a page and display busy cursor.
댓글 없음:
댓글 쓰기