PC SOFT

PROFESSIONAL NEWSGROUPS
WINDEVWEBDEV and WINDEV Mobile

Home → WINDEV 2024 → WB - Using External Javascript Components
WB - Using External Javascript Components
Started by André Labuschagné, Aug., 12 2017 8:18 PM - 15 replies
Posted on August, 12 2017 - 8:18 PM
Hi All

I am completely out of my depth here. I am trying to use an external javascript library. I have seen where to include all the header scripts. Now I am wanting to include statements in the body of the page. For example, I need to declare a div. Where do I do this?

I hope I have made myself clear.

Cheers
André
Posted on August, 12 2017 - 8:41 PM
Hi Andre

What I did was just include an HTML control on the page and in the javascript code referred to the alias of that control i.e. A1.

It also depends on the type of control. The above worked for a Pivot control I tested but for ckeditor I used a multiline edit control.

Regards


Ericus Steyn
Posted on August, 12 2017 - 10:04 PM
Hi Eric

Thanks - I will try that now.

Cheers
André
Posted on August, 12 2017 - 10:14 PM
Hi Ericus

Nah - that did not work. I do wish there was a good example showing how to do this. I need to be pointed to where I can insert extra code in the body of the html and so on.

Cheers
André
Posted on August, 13 2017 - 4:42 PM
Hi Andre

It works with the HTML control on the page and the function in the example that Syncfusion uses (I assume that is the spreadsheet control you are referring to" should be changed to:

$(function () {
$('#A1').ejSpreadsheet();
});

Where A1 is the ID of the HTML control.

Regards
Posted on August, 13 2017 - 6:22 PM
Hi Eric

That is exactly what I am looking at. Will have a look at it right now and report back.

Cheers
André
Posted on August, 13 2017 - 8:39 PM
Hi Ericus

That compiles and runs with no errors but the control does not display. The js files have been included.

Not sure where to put the code.

I have put it into onload JS and in the html code for the html control itself. Still does not display.

Any ideas?

Cheers
André
Posted on August, 13 2017 - 9:40 PM
Hi Andre

In the Page Description in the Advance Tab in HTLM you add this to the page header:


<!-- jquery script -->

<!-- jsrender script -->

<!-- Essential JS UI widget -->

<!--Add custom scripts here -->


Then in the onload event of the page I changed that from WL to JS and these are the only lines of code in there:

$(function () {
$('#A1').ejSpreadsheet();
});

Nothing in the HTML control. It is just resized to fill the page

No other code at all in the page.

Regards


Ericus
Posted on August, 13 2017 - 10:18 PM
Hi Ericus

Thanks a ton. I will give that a shot now.

Cheers
André
Posted on August, 13 2017 - 11:07 PM
Hi Ericus

I have all that but the control does not display at all.

Cheers
André
Posted on August, 13 2017 - 11:14 PM
Hi Ericus

Thanks a ton for all your help. It is displaying now. I have the general idea of how this all works.

Cheers
André
Posted on August, 14 2017 - 12:59 AM
Hi Ericus

I am finding it to be quite slow but am investigating further.

There a few that I am looking at but have the general idea now how to included an external JavaScript library and/or component.

Cheers
André
Posted on August, 16 2017 - 2:09 AM
Hi

Are you using webdev 22?

There is e new control that does it all. " The webcomponent control "


regards

allard
Posted on August, 16 2017 - 9:38 PM
Hi Allard

No this is WB 19. I cannot take the risk of porting to WB 22 now.


Regards


Ericus Steyn
Posted on August, 16 2017 - 10:32 PM
Hi Allard

"Webcomponent control" sounds interesting.

WB19, 20 and 21 for testing. We have not upgraded to 22 yet. Far too risky at this stage.

Cheers
André