cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
eliz_talent
Helper II
Helper II

PCF jquery & bootstrap: "error occured during initialization of control: AB.FirstPCF;Message: control.popover is not a function"

I am trying to create a PCF control with popover for a text field.

I have installed jquery, bootstrap, types/jquery, types/bootstrap.

In index.ts file I import jquery and bootstrap:

import * as $ from "jquery";
import * as Bootstrap from "bootstrap";

This is the code I use:

this.setPopover = (function () {
			var control = $(this.inputControl);
			if (typeof (control) == 'undefined') {
				setTimeout(this.setPopover, 500);
			}
			else {
				control.popover(
					{
						content: (context.parameters.sampleProperty.attributes && context.parameters.sampleProperty.attributes.Description) || "Description is not available",
						placement: "right",
						trigger: "hover"
					});
			}
		});
		this.setPopover();

 and receive an error "error occured during initialization of control: AB.FirstPCF;Message: control.popover is not a function".

Any suggestion here?

 

2 REPLIES 2
DianaBirkelbach
Super User
Super User

Hi @eliz_talent , 

I think the problem is calling the setPopover directly after definition.
The definition of your controls should be inside the init method of your PCF.

Hope this helps!

Kind regards,

Diana

Kind regards,
Diana
----------
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."
eliz_talent
Helper II
Helper II

Thank you, Diana for responding.

Unfortunately, I didn't manage to fix the issue. From other experience with PCF, it looks like the harness does not work properly with a lot of things in custom controls.  

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Users online (1,895)