public void Mount(string tabId, jQuery docksite) { jQuery tab = docksite.Children($".tab[data-tabid='{tabId}']"); if (tab.Length == 0) { tab = docksite.Append($"<div class='tab' data-tabid='{tabId}'><header></header></div>"); tab.On("click", "header > a", new Action <MouseEvent>(OnClickTabHeader)); } else { RefreshTabHeader(tab.First()); tab.Off("click", "header > a"); tab.On("click", "header > a", new Action <MouseEvent>(OnClickTabHeader)); } }
public void RefreshTabHeader(jQuery tabElement) { jQuery pages = tabElement.Children(".page"); jQuery header = tabElement.Children("header"); header.Remove("a"); pages.Each((pid, page) => { var jpage = new jQuery(page); header.Append($"<a href='' data-pageid='{jpage.Attr("data-pageid")}'>{jpage.Attr("data-page-title")}</a>"); }); jQuery active = tabElement.Children(".page.active"); if (active.Length == 0) { active = pages.First(); } ShowTab(tabElement, active); }