Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to use JavaScript in IW
#1
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
Reply
#2
Hi Shane. Change only the quotation marks on your CallBack:

Code:
WebApplication->CallBackResponse->AddJavaScriptToExecute(L'$("#INFORMATIONPANEL").collapse("show");');
Reply
#3
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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)