|
<< Click to Display Table of Contents >> Navigation: Telegram > 2020 > 07 > 16 > Telegram_2020-07-16T23 |
2020-07-16T23:11:56
Hi Alexandre! What is the difference between executeAjaxevent vs processAjaxevent? I need to execute a jQuery function from the template to modify the menu. AddToInitProc() works also but I am looking a best way to do it. A callback is also mentioned
2020-07-16T23:13:21
Yes that is
2020-07-16T23:14:52
Just remember that if you are going to call several times methods or properties of that ( type: hashtag #fin ) object is better to assign it to a variable, and then use the variable to call the methods or set properties.
2020-07-16T23:16:19
ExcuteAjaxEvent and processAajaxEvent are suited to trigger iw component's OnAsynXXX Events
2020-07-16T23:17:08
If you want call a IW Callback. It is better to use AjaxCall function
2020-07-16T23:18:00
Should I set it to a variable on the template side and call only the variable with AddToInitProc ?
2020-07-16T23:19:25
No necesarily, you can create a complete JS script and pass it to the AddToInitProc
2020-07-16T23:22:26
check Doc: type: link http://docs.atozed.com/docs.dll/development/Async%20callbacks%20in%20IntraWeb%2015.1.html
and the demos:
type: link https://github.com/Atozed/IntraWeb/blob/master/XIV/Delphi/CustomAjaxCall/
type: link https://github.com/Atozed/IntraWeb/tree/master/15/Delphi/NewCallback
2020-07-16T23:22:35
I have tested my function by placing it in $(documents).ready and it disables a specific menu when the template loads; but what I am doing is creating functions per profile categories and only call the one that fits the current user
2020-07-16T23:24:02
Ok I will have a look thanks for your help. I have learned html,css and jQuery in two days
2020-07-16T23:24:17
That is the best way to go
2020-07-16T23:24:31
Thanks
2020-07-16T23:26:17
regarding that, that is what AddToInitProc does, it create a global $(documents).ready function and put in there all Scripts that you pass to AddToInitProc
2020-07-16T23:28:20
But let’s say I two functions that I have to call; should I repeat AddToInitProc twice ?
2020-07-16T23:29:35
Sorry I wanted to say if I have two functions that I have to call
2020-07-16T23:29:55
AddToInitProc add the string you pass to a list fo scripts.
2020-07-16T23:30:14
it will not replace anything, it is like a Tstringlist.add
2020-07-16T23:30:36
Ok I got it now thanks
2020-07-16T23:32:12
But just use AddToInitProc to send Scripts that will be excuted when the Page is loaded, and aonly if you need to instantiate global stuff, if not it is better to use AddJavaScriptToexecute
2020-07-16T23:34:15
It is like : WebApplication.AddJavaScriptToexecute(‘jsfunc’) ?
2020-07-16T23:35:32
and about the 'variable example:
xString := 'var xMenuOption = $(“ type: hashtag #fin ”);'+EOL+
'xMenuOption.prop(“disabled”,true);'+EOL+
'xMenuOption.;'
2020-07-16T23:36:01
webapplication.callbackresponse.addjavascriptToexecute(‘jsfunc’)
2020-07-16T23:36:21
ok thanks
2020-07-16T23:38:09
using a variable you prevent to Initialize a jquery object ecah time you use '$(“ type: hashtag #fin ”)' and it is easier to write
2020-07-16T23:38:48
Ok thanks for your help
2020-07-16T23:42:13
Youre welcome, dont forget to check the demos. and as for what is the difference beteeen ExecuteAjaxEvent, ProcessAjaxEvent and AjaxCall, only type: mention @Alex7691 can help on that, I remember that one of them blocks the UI while executing but dont know if that is the only difference.
2020-07-16T23:42:55
Thank you Sir
2020-07-16T23:43:01
There was a documentation in Intraweb about ExecuteAjaxEvent, but seems to be lost now.
2020-07-16T23:44:06
Yes Intraweb is a great product except the documentation is so poor