jQuery UI Widgets › Forums › Plugins › AngularJS › jqx-popover bug
This topic contains 4 replies, has 3 voices, and was last updated by lastday1225 8 years, 7 months ago.
-
Authorjqx-popover bug Posts
-
I’m using the angularjs jqx-popover controls.
I found some critical bugs.I use an ui-view for changing pages.
Every times popover increased the popover object.
Probably the jqx-popover everytimes adding ui body(title, contents, events…).
The jqx-popover has property(initcontents) but it just init the contents.I tried to use the other library(bootstrap ui popover).
It worked normally.What should I do for normally using popover?
Hi lastday1225,
We do not know how you use jqxPopover. We have AngularJS example with it and it works fine there.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comThe supported example is too simple.
It use just only one page.
Angularjs basically used for SPA.
Actually we can’t use such as examples.We has A, B pages.
A page has popover.
B page doesn’t have any popover.when some people click menu A and then click popover button, it normally show up popover at first.
And, click go on menu B(page B).
If we again click go menu A, and then click popover button, it has two popover object.A main page has two ng-ui(or ui-view) view, jqx-popover has some problem.
I think that it append to body tag.
probably it doesn’t initialize object. So it increase same popover elements in body(every render times).under code is the jqxpopover.js.
render: function () { var that = this; var contentId = that.element.id; that._content.detach(); that._toggleElement = $(that.selector); if (that._toggleElement.length === 0) { throw new Error('jqxPopover: Invalid Popover toggler: "' + that.selector + '".'); } else if (that._toggleElement === null) { throw new Error('jqxPopover: Missing Popover toggler.'); } var template = $('<div id="' + contentId + '" class="' + that.toThemeProperty("jqx-popover") + '"><div class="' + that.toThemeProperty("jqx-popover-arrow") + '"></div><div class="' + that.toThemeProperty("jqx-popover-title") + '"></div><div class="' + that.toThemeProperty("jqx-popover-content") + '"></div></div>'); $("body").append(template);
When I use same code using angular-bootstrap popover, it perfectly work.
Hi lastday1225,
We do not initialize the widget more than once. In addition, it does not matter if “render” method is called many times. It adds a new element, Yes and it removes the Old element i.e you always have 1 element.
Example:
<!DOCTYPE html> <html lang="en"> <head> <title id='Description'>jqxPopover example</title> <link type="text/css" rel="Stylesheet" href="../../jqwidgets/styles/jqx.base.css" /> <script type="text/javascript" src="../../scripts/jquery-1.11.1.min.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxpopover.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxbuttons.js"></script> <script type="text/javascript" src="../../scripts/demos.js"></script> <script type="text/javascript"> $(document).ready(function () { // prepare the data var data = new Array(); var firstNames = ["Nancy", "Andrew", "Janet", "Margaret", "Steven", "Michael", "Robert", "Laura", "Anne"]; var lastNames = ["Davolio", "Fuller", "Leverling", "Peacock", "Buchanan", "Suyama", "King", "Callahan", "Dodsworth"]; var titles = ["Sales Representative", "Vice President, Sales", "Sales Representative", "Sales Representative", "Sales Manager", "Sales Representative", "Sales Representative", "Inside Sales Coordinator", "Sales Representative"]; var titleofcourtesy = ["Ms.", "Dr.", "Ms.", "Mrs.", "Mr.", "Mr.", "Mr.", "Ms.", "Ms."]; var birthdate = ["08-Dec-48", "19-Feb-52", "30-Aug-63", "19-Sep-37", "04-Mar-55", "02-Jul-63", "29-May-60", "09-Jan-58", "27-Jan-66"]; var hiredate = ["01-May-92", "14-Aug-92", "01-Apr-92", "03-May-93", "17-Oct-93", "17-Oct-93", "02-Jan-94", "05-Mar-94", "15-Nov-94"]; var address = ["507 - 20th Ave. E. Apt. 2A", "908 W. Capital Way", "722 Moss Bay Blvd.", "4110 Old Redmond Rd.", "14 Garrett Hill", "Coventry House", "Miner Rd.", "Edgeham Hollow", "Winchester Way", "4726 - 11th Ave. N.E.", "7 Houndstooth Rd."]; var city = ["Seattle", "Tacoma", "Kirkland", "Redmond", "London", "London", "London", "Seattle", "London"]; var postalcode = ["98122", "98401", "98033", "98052", "SW1 8JR", "EC2 7JR", "RG1 9SP", "98105", "WG2 7LT"]; var country = ["USA", "USA", "USA", "USA", "UK", "UK", "UK", "USA", "UK"]; var homephone = ["(206) 555-9857", "(206) 555-9482", "(206) 555-3412", "(206) 555-8122", "(71) 555-4848", "(71) 555-7773", "(71) 555-5598", "(206) 555-1189", "(71) 555-4444"]; var notes = ["Education includes a BA in psychology from Colorado State University in 1970. She also completed 'The Art of the Cold Call.' Nancy is a member of Toastmasters International.", "Andrew received his BTS commercial in 1974 and a Ph.D. in international marketing from the University of Dallas in 1981. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager in January 1992 and to vice president of sales in March 1993. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.", "Janet has a BS degree in chemistry from Boston College (1984). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate in 1991 and promoted to sales representative in February 1992.", "Margaret holds a BA in English literature from Concordia College (1958) and an MA from the American Institute of Culinary Arts (1966). She was assigned to the London office temporarily from July through November 1992.", "Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree in 1976. Upon joining the company as a sales representative in 1992, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London. He was promoted to sales manager in March 1993. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management.' He is fluent in French.", "Michael is a graduate of Sussex University (MA, economics, 1983) and the University of California at Los Angeles (MBA, marketing, 1986). He has also taken the courses 'Multi-Cultural Selling' and 'Time Management for the Sales Professional.' He is fluent in Japanese and can read and write French, Portuguese, and Spanish.", "Robert King served in the Peace Corps and traveled extensively before completing his degree in English at the University of Michigan in 1992, the year he joined the company. After completing a course entitled 'Selling in Europe,' he was transferred to the London office in March 1993.", "Laura received a BA in psychology from the University of Washington. She has also completed a course in business French. She reads and writes French.", "Anne has a BA degree in English from St. Lawrence College. She is fluent in French and German."]; var movies = $("#movies"); for (var i = 0; i < firstNames.length; i++) { var row = {}; row["firstname"] = firstNames[i]; row["lastname"] = lastNames[i]; row["title"] = titles[i]; row["titleofcourtesy"] = titleofcourtesy[i]; row["birthdate"] = birthdate[i]; row["hiredate"] = hiredate[i]; row["address"] = address[i]; row["city"] = city[i]; row["postalcode"] = postalcode[i]; row["country"] = country[i]; row["homephone"] = homephone[i]; row["notes"] = notes[i]; var imgurl = '../../images/' + firstNames[i].toLowerCase() + '.png'; var img = '<img height="50" width="45" src="' + imgurl + '"/>'; var table = '<table style="min-width: 150px;"><tr><td style="width: 55px;" rowspan="2">' + img + '</td><td>' + firstNames[i] + " " + lastNames[i] + '</td></tr><tr><td>' + titles[i] + '</td></tr></table>'; movies[0].innerHTML += table; } $("#button").jqxButton({ template: "inverse" }); $("#popover").jqxPopover({ offset: { left: -50, top: 0 }, arrowOffsetValue: 50, title: "Employees", showCloseButton: true, selector: $("#button") }); $("#popover").jqxPopover('render'); $("#popover").jqxPopover('render'); $("#popover").jqxPopover('render'); $("#popover").jqxPopover('render'); $("#popover").jqxPopover('render'); $("#header").addClass('jqx-widget-header'); if (theme) { $("#header").addClass('jqx-widget-header-' + theme); } }); </script> </head> <body> <div id="popover"> <div id="movies"> </div> </div> <div style="height: 33px; border-width: 1px; border-style: solid; padding:10px;" id="header"> <button style="float: right; margin-right: 10px; padding: 8px 12px; border-radius: 6px;" id="button">View Employees</button> </div> </body> </html>
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comThanks for reply.
But, I use develop program using angularjs.
Your sample is a simple jquery program.
If you make a sample using angularjs jqx-popover control.<jqx-popover id="jpopover_PopupSearch" jqx-settings="St_PopupSearchSetting" style="border: black 1px solid;"> <div class="panel panel-default"> <div class="list-group" > <a id="grantPopupLink" ng-click="Fn_PopupSearchJobSendToVisual()" class="list-group-item">AAA</a> <a id="grantPopupLink" ng-click="Fn_PopupSearchJobSendToReport()" class="list-group-item">BBB</a> </div> </div> </jqx-popover>
-
AuthorPosts
You must be logged in to reply to this topic.