response to Animal, why sync AJAX can be useful
Unit test with JSUnit, as I run a scenario, I need to open a file and parse it.. This is one example where it would be useful to have sync: option.
What's the best way for Ext JS 2.3?
Use case for Sync AJAX request
We have some tree. Each node of this tree corresponds to some data record in database table on server. For example we have table that contains hierarchy of product categories of internet-shop (task list in project management system, groups and users in instant messenger store, ...) - in any real project tree data structure is used.
Now... We have UI built on ExtJS library. TreePanel, TreeNode, ... and TreeEditor. Some user (admin, project manager, IM user, ...) tries to rename node of tree. What do we need? We have to send request to web server where some server application should save changed data to database. And this request can be whether successful or not. And we must not do something with tree node before we get response (success or failure) from server.
ExtJS. TreeEditor. What can we do during renaming node? We can subscribe on 'beforecomplete' event and create request there. But we have to cancel or submit edit at once. So user will see whether renamed node or old name in incorrect way. Because maybe renaming won't be done in the database.
And there are many cases when UI mustn't be changed before response from server comes. Because if we can't use UI library bound to real data it's meaningless.
I think I've described use case in depth. So, if somebody can explain me how I should realize it with ExtJS I will be very thankful. Because I decided to try using ExtJS in some project about two months ago and if to be honest I am very disappointed so far...
PS And this issue happens when any update (data changes) takes place... For more example - drag'n'drop functionality...
Quote:
Originally Posted by
Animal
Can anyone provide a use case for synchronous requests?