PC SOFT

PROFESSIONAL NEWSGROUPS
WINDEVWEBDEV and WINDEV Mobile

Home → WEBDEV 2024 → Update Combo_Intro after Ajax call
Update Combo_Intro after Ajax call
Started by Tony Turner, Feb., 07 2017 7:37 AM - 2 replies
Posted on February, 07 2017 - 7:37 AM
Hi,

I am using ajax to update some db data, i don't want to wait for the ajax to finish but when it does finish I want to run
ListDisplay(Combo_Intro,tainit) to refresh the list box based on the modified data.

I can't see how I can do that using AJAXExecuteAsynchronous as you cant use ListDisplay(Combo_Intro,tainit) within the server procedure, it doesn't error it just doesn't do anything if I put it on the code after the db data update.

It all works in the sence that the data update I get a message saying saved.

But how can I refresh the Combo_Intro control ?

IF AJAXAvailable() = True THEN
// Run the server procedure named "MyProc"
// As soon as the result of the "MyProc" server procedure becomes available,
// the "ProcResult" browser procedure will be run
Res is int
Res = AJAXExecuteAsynchronous(ModifyData,ProcResult,gsNumber,"COMBO_Intro",COMBO_Intro..Value)
// The following processes are run without waiting for the result
ELSE
// do nothing here for now
END


Procedure ModifyData(Number is string, sUpdateData is string,sNewVal)

update db Data

// this does nothing and no error so I need to update control when browser proc is run how pls?
ListDisplay(Combo_Intro,taInit)


Procedure ProcResult(ModifiedData, Res)
ToastDisplay("Saved",toastShort,vaTop,haCenter,iLightRed)


How can the Browser procedure refresh the list box which is initialised by the server code?

Thanks

Tony
Posted on February, 07 2017 - 10:49 AM
Hi Tony,

look at the ajaxUpdateControls option of ajaxexecuteasynchronous

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

Ready for you: WXShowroom.com, WXReplication (open source) and now WXEDM
(open source)

More information on http://www.fabriceharari.com


Le 2/7/2017 à 1:37 AM, Tony Turner a écrit :
Hi,

I am using ajax to update some db data, i don't want to wait for the
ajax to finish but when it does finish I want to run
ListDisplay(Combo_Intro,tainit) to refresh the list box based on the
modified data.

I can't see how I can do that using AJAXExecuteAsynchronous as you cant
use ListDisplay(Combo_Intro,tainit) within the server procedure, it
doesn't error it just doesn't do anything if I put it on the code after
the db data update.

It all works in the sence that the data update I get a message saying
saved.

But how can I refresh the Combo_Intro control ?

IF AJAXAvailable() = True THEN
// Run the server procedure named "MyProc"
// As soon as the result of the "MyProc" server procedure becomes
available, // the "ProcResult" browser procedure will be run
Res is int
Res =
AJAXExecuteAsynchronous(ModifyData,ProcResult,gsNumber,"COMBO_Intro",COMBO_Intro..Value)

// The following processes are run without waiting for the result
ELSE
// do nothing here for now
END


PROCEDURE ModifyData(Number is string, sUpdateData is string,sNewVal)

update db data

// this does nothing and no error so I need to update control when
browser proc is run how pls?
ListDisplay(Combo_Intro,tainit)


PROCEDURE ProcResult(ModifiedData, Res)
ToastDisplay("Saved",toastShort,vaTop,haCenter,iLightRed)


How can the Browser procedure refresh the list box which is initialised
by the server code?
Thanks

Tony
Registered member
19 messages
Posted on December, 18 2018 - 5:13 PM
Hi Fabrice
I have a similar problem but on table control, where I can't pass directly the control properties (table control are not accessbile browser side) to my Ajax procedure
Then I try to pass to my Ajax procedure the name of the control (even text box than list box).
In my Ajax Porcedure, the control..value give me the PREVIOUS value (before the modification)!
I go back to the control, another modify and another time in Ajax I obtain the previous value.
Note that I don't change record: I remain on the same row!
Where is my mistake? Is there another way to obtain the correct value I wrote in the field (or chose from the list)?
Thanks
Franco