PDA

View Full Version : [CLOSED] Making a call synchronous



CanopiusApplications
Oct 21, 2014, 5:26 PM
Guys

If there a way to make a function callback syncronous, something like




MyApp.direct.ctlJobStati.GetProgress(1584, {

success: function (result) {

if (result == '-1') {
value = value + " (?)";
}
else {
value = value + " " + result + "%";
}
}

}, WAIT);



I know in jQuery you can use something like $.ajax {,,,,,, async:false }

In this case I am rendering a grid and need to wait for the return from a WCF call to render a certain column. Non critical though as I do not like this implementation and will probably end up calling the WCF service from server side code and pre-populating the grid store.

Ta,
D

Daniil
Oct 22, 2014, 5:18 AM
Hi @CanopiusApplications,

It might look like that.

App.direct.TestDirectMethod('test', {
async: false,
success: function (result) {
alert("The DirectMethod is done.");
}
});
or

App.direct.SomeDirectMethod('some parameter', {
async: false
});
alert("The DirectMethod is done.");

Though, I would want to ask the same.
http://forums.ext.net/showthread.php?38431&p=174121&viewfull=1#post174121

CanopiusApplications
Oct 22, 2014, 9:00 AM
Hi D

Thanks -- I did work it out in the end myself once I started to use my brain ;-).

Ok the reason for this is we have a grid and in one of the columns render event we get another value from a wcf service and depending on the result here we apply some formatting to the column using the returned result and hence the need to it to be synchronous. Now the obvious question is then wtf are not calling the service from the server and pre-populating the grid with what you need and then formatting -- well the short answer is because I was being a bit of an idiot and hence my earlier post stating "I am not a fan of this implementation" so this post was ultimately more out of curiosity than anything else.

Another thing when searching the forums your link did not come up in the search results for some reason (unless I missed it).

Ta,
D

Daniil
Oct 22, 2014, 9:27 AM
Thank for the explanation:)


Another thing when searching the forums your link did not come up in the search results for some reason (unless I missed it).

Well, it happens.

Sometimes I mark the threads with tags. Before searching I remind that I marked some thread regarding to synchronous AJAX. So, I type "sync..." in the tag search field here and saw the list of possible tags.
http://forums.ext.net/search.php

I ended up with the "synchronous AJAX" tag and found the thread that I wanted to find.

By the way, if search via Google with the "synchronous AJAX" request, that thread goes first:)