Select a specific tab and update based on the jquery Easyui

Source: Internet
Author: User

Gets the selected Tab

Gets the tab panel selected and its tab object  var pp = $ (' #tt '). Tabs (' getselected ');  var tab = pp.panel (' Options '). tab;  The corresponding Tab object

Update a specific tab panel using the Update method, the Param parameter contains 2 properties:

Tab: The tab that will be updated.

Options: Tab-related configuration items.

Example:

// current tab  Update tabs operation var current_tab = $ (' #frame_tabs '). Tabs (' getselected '); $ (' #frame_tabs '). Tabs ( ' Update ', {    tab:current_tab,    options: {      ' <iframe scrolling= ' auto ' frameborder= ' 0 ' src= ' + url+ ' "style=" width:100%;height:100%; ></iframe> ',    //   }}); $ (document). Ready (function () {   $ (' #frame_tabs '). Bind (' DblClick ', function () {     = $ ('). Tabs-selected '). text ();     $ (' #frame_tabs '). Tabs (' Close ', title);    });


Re:tabs How to make a specific tab selected when initializing

$ (' #tt '). Tabs (' Update ', {tab:$ (' #tt '). Tabs (' Gettab ', ' Tab2 '), options:{selected:true }});


Currently used in my project Yes is

<div id= "Tabs"class= "Easyui-tabs" style= "width:1160px;" ><div id= "tabs-1" title= "basic Information" data-options= "Fit:true" ><div id= " Tabs-2 "title=" Bidding Information "data-options=" Selected:true ">//This will be loaded when the state is selected can be in the background to save a global variable, and then assign the value to the interface, the value of the interface via JS, and then judge the setting increase data-options= "selected:true"function Settab () {var sTab= $ ("#selectTab"). Val (); if(STab = = "1") {      $("#tabs"). Tabs ("select", 0); }    if(STab = = "2") {      $("#tabs"). Tabs ("select", 1); //$ ("#tabs-2"). attr ("Data-options", "selected:true");    }    if(STab = = "3") {      $("#tabs"). Tabs ("select", 2); }    if(STab = = "4") {      $("#tabs"). Tabs ("Select", 3); }  }

Select the Ztree content and implement the update Add feature. Update is done without tabs adding add implementation exits.

$ ("#tree"). Tree ({data:treedata, lines:true, Onclick:function (node) {//alert (node.id);                if(node.attributes) {opentab (Node.text,node.attributes.url);                }            }        }); function Opentab (text,url) {if($ ("#tabs"). Tabs (' exists ', text)) {        //$ ("#tabs"). Tabs (' select ', text); //window.location.reload ();var Current_tab = $ (' #tabs '). Tabs (' getselected ')); $(' #tabs '). Tabs (' Update ', {tab:current_tab, options: {content:' <iframe scrolling= ' auto ' frameborder= ' 0 "src=" ' +url+ ' "style=" width:100%;height:100%; " ></iframe> ',                      //or href: ";                     }                }); }Else{var content= "<iframe frameborder= ' 0 ' scrolling= ' auto ' style= ' width:100%;height:100% ' src=" +url+ "></iframe>"; $("#tabs"). Tabs (' Add '), {title:text, closable:true, content:content}); }        }




Select a specific tab and update based on the jquery Easyui

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.