jQuery UI Widgets Forums Layouts DockPanel Calling jqxDockPanel on Dynamic Content

Tagged: 

This topic contains 3 replies, has 2 voices, and was last updated by  support 11 years, 4 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • Calling jqxDockPanel on Dynamic Content #15011

    Hello,

    I’m currently experiencing some problems getting jqxDockPanel to work on content that is dynamically loaded after the initial page has loaded.

    I’ve been spending some time debugging, and it appears that in jqx.jqxWidgetProxy the method a.data() returns undefined. This leads me to believe that some initialization has not been performed on the element.

    Is there a method that I should call on dynamic content to ensure it is properly initialized for jqWidgets?

    Thank you for any assistance,
    Michael

    Calling jqxDockPanel on Dynamic Content #15073

    support
    Participant

    Hi Michael,

    Could you please provide us with a sample which demonstrates with a scenario.

    Best Wishes,
    Mariya

    jQWidgets Team
    http://www.jqwidgets.com

    Calling jqxDockPanel on Dynamic Content #15358

    Hi Mariya,

    Sorry for the delay. If you look at the demos/jqxdockpanel/defaultfunctionality.html in your current release, and change its document.ready function to the following, you’ll see what i’m talking about:

    $(document).ready(function () {
    // Create jqxDockPanel
    var theme = $.data(document.body, ‘theme’);
    if (theme == null || theme == undefined) theme = ”;
    var panel = $(“#jqxDockPanel”);
    panel.remove();
    $(“#jqxDockPanel”).jqxDockPanel({ width: 300, height: 210, theme: theme });
    panel.prependTo($(“#jqxWidget”));

    It appears that elements require to be part of the visible element tree in order for the jqxWidget extension methods to work as expected. If you can imagine using a templated mvvm framework such as Knockout (or Durandal, in my case), you can see where this might cause problems, as script is being executed when a file loads, but the elements that the script is executing against haven’t necessarily been appended to the visual element tree when this occurs.

    Hope this helps,
    Michael

    Calling jqxDockPanel on Dynamic Content #15366

    support
    Participant

    Hi Michael,

    $(“#jqxDockPanel”) will not work if the DIV tag with id=”jqxDockPanel” is not part of the DOM. As no HTML element is selected, the initialization of the widget will not work in this case, too.

    Best Wishes,
    Mariya

    jQWidgets Team
    http://www.jqwidgets.com

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.