|
<< Click to Display Table of Contents >> Navigation: Forum > How to use JavaScript in IW |
11-30-2018, 03:54 AM:
Howdy All,
I am trying to call a javascript function on a control from a C++ async event.
If the region control's name is InformationPanel, and I wish to call a method called collapse with a parameter value of 'show' or 'hide', how do I execute a command of such from C++/Dephi code:
$(InformationPanel).collapse('show');
Also, how would I register a callback on a function of the format to call a Delphi event:
$('#InformationPanel').on('hidden.bs.collapse', function ()
{
// do something…
})
I have tried the normal callback method/register like I have for button onclick events, but this one complains in the browser's console about a syntax error on my hooking of the event.
Thanks in advance,
Shane
Howdy All!
I knew I had called the function before. For those who don't know, the solution to call the aforementioned method is as follows:
WebApplication->CallBackResponse->AddJavaScriptToExecute(L"$('#INFORMATIONPANEL').collapse('show');");
I still cannot get the
11-30-2018, 10:09 AM:
Hi Shane. Change only the quotation marks on your CallBack:
Code:
WebApplication->CallBackResponse->AddJavaScriptToExecute(L'$("#INFORMATIONPANEL").collapse("show");');
11-30-2018, 02:38 PM:
Howdy Jose!
Thanks for the reply. I didn't realize I cut my response to myself off last night but the code I wrote works! Remember I am in C Builder and C++ uses double quotes and not single quotes.
What I need to work on this morning is registering the callback events to work. Since I am well rested, that is my task after I drink a pot of strong brew!
All the best,
Shane