jqueryjquery-uijquery-ui-widget-factory

How can widget.bridge connect a jquery jquery-ui?


I want to upgrade jQuery and jQuery UI's version in my project

but tabs widget has problem.

active event is not working

so i want fix it and know what is wrong

how does $("tabs").tabs("option", "active", tab_index) move to function $.widget.bridge ?????

and i wonder how widget.birdge works

here is my code

    v_Tabs.obj
        = $("tabs").tabs({

            activate: function (event, ui) {
                gw_com_api.hide("lyrAdd");
                var page = "page_" + v_Tab.index;
                                    var content =
                    "<iframe" +
                        " id='" + page + "'" +
                        " src='" + v_Tab.content +
                        "?USR_ID=" + v_Session.USR_ID +
                        "'" +
                        " width='100%'" +
                        " height='550px'" +
                        " frameborder='yes' scrolling='no' marginheight=0 marginwidth=0" +
                    ">" +
                    "</iframe>";
                $(ui.panel).append(content);
            }
        });

    v_Tabs.obj.tabs("option", "active", tab_index);

Solution

  • A few small fixes should get you on your way.

    jQuery

    v_Tabs.obj = $("#tabs").tabs({
      activate: function(event, ui) {
        gw_com_api.hide("lyrAdd");
        var page = "page_" + v_Tab.index;
        var content = $("<iframe>", {
          id: page,
          src: v_Tab.content + "?USER_ID=" + v_Session.USR_ID,
          width: '100%',
          height: '550px',
          frameborder: 'yes',
          scrolling: 'no',
          marginheight: 0,
          marginwidth: 0
        });
        $(ui.newPanel).append(content);
      }
    });
    

    Example: https://jsfiddle.net/Twisty/ygb0o68b/

    I suspect you need ui.newPanel to contain the iframe. Using jQuery to create the element gives you a nicer degree of control. You also have to make sure your selector is correct.