Easyui Taps Plugin Add new tab parameters content configuration Issues

Source: Internet
Author: User

Their work in the face of problems, just their own records, just part of the code, you may also encounter similar problems, although the expression is not very rigorous and thoughtful, similar problems can be referred to under.

function AddTab (subtitle, URL, icon, id) {   //Add tab functions
if (!$ (' #tabs '). Tabs (' exists ', subtitle)) {
$ (' #tabs '). Tabs (' Add ', {
Title:subtitle,
Content:createframe (Id,url),//tab content parameter, with function return value, function definition below
Closable:true,
Icon:icon
});
} else {
$ (' #tabs '). Tabs (' select ', subtitle);
Refresh
$ (' #mm-tabupdate '). Click ();
}
Curtab = subtitle;
Tabclose ();
}

function createframe (ID, url) {
var s = ' <iframe id= ' + ID + ' "scrolling=" Auto "frameborder=" 0 " src= '
+ URL + ' "style=" width:100%;height:100%; " ></iframe> ';
return s;
}//the function stitching the string and returning it as a content value

First, the initial understanding of the content is a string format, to change the contents of the tab to change the function definition, the internal definition of the implementation of the target content into a string and then return it.
(later tested content can be a number value, normal display, object value does not show no error, array error)

Test function
function AA () {//Failure method          
Added static HTML <div id= "AA" style= "><table style=" height:300px "class=" TT "in tab body structure ></table> </div> to create a DataGrid
$ ('. tt '). DataGrid (obj);
var s=$ ("#aa"). Get (0). InnerHTML;
return s;
The}//problem is that only the first click of the Tree menu takes effect because the static structure can only be used once, and the first click on the menu node can be used
The second click of the menu node does not have access to the


---------cause for the time being unknown


Second, change the idea of the first Html <div id= "AA" style= "" ><table style= "height:300px" class= " tt" ></table></div > Dynamically add to tab and then callback to create a DataGrid in an existing structure.
function bb () {
var s = ' <div id= ' AA "style=" "><table style=" height:300px " id=" tt "></table></div>";
Cannot use ID ID unique multiple tabs between IDs will conflict to class name just fine
var ss = ' <div id= ' AA "style=" "><table style=" height:300px " class=" tt "></table></div>";
return SS;
}
AddTab (Treenode.name, Treenode.action_url, "", treenode.id);
$ (". tt"). DataGrid (obj);//Add a sentence after adding a tab to create a DataGrid.
Addressed the content configuration issue.

Easyui Taps Plugin Add new tab parameters content configuration Issues

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.