EasyUI Forum
November 30, 2025, 04:40:50 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: [Solved]Reorder Tabs from Code  (Read 9779 times)
MSAG
Newbie
*
Posts: 41



View Profile Email
« on: January 12, 2019, 07:39:34 AM »

Hi
As doc of insert tab in special location we must use index to set like this:

// add a unselected tab panel
$('#tt').tabs('add',{
   title: 'new tab',
   selected: false
   //...
});

// insert a tab panel to the index 2
$('#tt').tabs('add',{
   title: 'inserted tab',
   index: 2
})


but what about if we just want to reorder old tab without lose content of its

i tried to use update like this:

oldtab.panel("options").index =newIndex;
$('#tt').tabs('update', { tab: oldtab, index: newIndex, options: oldtab.panel("options"), type: "header" });


but that is not work

and then i tried to add more this code:

$(oldtab.panel('options').tab).parent().append(oldtab.panel('options').tab);

it is work to move tab to first location

and i use it to push all tabs as i wont

my problem is:
when i click on tabs it go to panel of old tab index (show me the panel for old index not the new)

how can i fix it

thanks a lot
« Last Edit: January 14, 2019, 07:37:04 PM by MSAG » Logged
MSAG
Newbie
*
Posts: 41



View Profile Email
« Reply #1 on: January 13, 2019, 10:11:45 AM »

Full my code of update to reorder tabs:


here code of sort my list LLogindTabInfo
then:


            for (i = 0; i < LLogindTabInfo.length; i++) {
                        if (dg.tabs('exists', LLogindTabInfo.Title)) {
                            var tab = dg.tabs('getTab', LLogindTabInfo.Title);
                            if (!tab.panel('options').href)
                                dg.tabs('update', { tab: tab, index: i, options: { href: LLogindTabInfo.Url } });
                            else {
                                tab.panel('options').index = i;
                                dg.tabs('update', { tab: tab, index: i, options: tab.panel("options"), type: "header" });
                            }
                        }
                        tab.panel('options').index = i;
                        $(tab.panel('options').tab).parent().append(tab.panel('options').tab);
                    }
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #2 on: January 14, 2019, 06:07:22 PM »

The 'move' method is available from the tabs extension https://www.jeasyui.com/extension/downloads/tabs-dnd.zip. Call the 'move' method to reorder the tab panels.
Code:
var tab = $('#tt').tabs('getSelected');
$('#tt').tabs('move', {
tab: tab,
index: 2
})
Logged
MSAG
Newbie
*
Posts: 41



View Profile Email
« Reply #3 on: January 14, 2019, 07:37:57 PM »

It's work thank you very much Mr. stworthy Grin Grin Grin Grin Wink
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!