tobiu
18 Aug 2007, 9:01 AM
hi together,
this posting is a work in progress-project!
based upon my poll "drag & drop with tabpanelItems"
http://extjs.com/forum/showthread.php?t=11112
i would like to start this user-extension, since it will not get part of the ext core for now.
i am hoping, that some users of the community will participate =)
project-roadmap:
1) first of all, it is important to detach and retach tabpanelItems
2) extending the tabpanel class, so that tabpanelItems get dragzones
3) making tabpanels to dropzones with animation like in grid-headers (small arrows between tab-buttons)
4) routines for sorting tabs (insert new tab at position x of y items)
5) putting it all together
the start
ok, lets get an easy testing-case. i would like a borderlayout and a layoutDialog, both with a center-region. these center-regions display tabs (have tabpanels). for the grids, i use a contructor class. so, here's the simplified syntax:
layout = new Ext.BorderLayout(document.body, {...,
center: {
titlebar: true,
autoScroll:true,
closeOnTab: true,
alwaysShowTabs: true
}
});
grid1 = new GridClass('home');
homeGrid = new Ext.GridPanel(grid1.grid, {title: 'Home', fitToFrame: true, closable: false});
layout.add('center', homeGrid);
centerRegion = layout.getRegion('center');
centerPanel = centerRegion.getTabs();
centerPanel.addTab("tabId2", "new tab", "some Content");
on an event, like button-click, we do create the new layoutDialog:
function openGridDialog () {
gridDialog = new Ext.LayoutDialog(...,
center:{
alwaysShowTabs: true
}
});
diaLayout = gridDialog.getLayout();
diaLayout.beginUpdate();
diaHomeGrid = new Ext.GridPanel(grid1.grid, {autoCreate:true,
title: 'Home', fitToFrame: true, closable: false});
diaLayout.add('center', diaHomeGrid); //lets keep it easy, this is the first tab with index 0
}
so, we created a new gridpanel, with an already existing grid.
this will detach the dom-container-element of the grid of the first gridPanel and attach it to the gridpanel in the layoutDialog. works fine.
the next step is bringing the grid back to the borderlayout:
function = restoreGrid () {
centerPanel.getTab(0).bodyEl.appendChild(grid1.grid.getGridEl().dom); //this line took tons of time =)
centerPanel.getTab(0).setHidden(false);
gridDialog.hide();
}
this demo is supposed to hide a tab, so, if you do detach and retach it, it will be displayed at the same position like it was before! we could make it optional to chose, if the tab should be inserted at the "end" of the tabPanel -> right side. this would need to remove the tab and insert a new one, atm impossible due to bug 1.
restoreGridDialogCategory () is a workaround for sure! this method only works fine, this the grid never looses the resize-listeners it has gotten by creating the first gridpanel. though it does work nice this way (except it has the resize-listeners of the dialog too...).
this posting is a work in progress-project!
based upon my poll "drag & drop with tabpanelItems"
http://extjs.com/forum/showthread.php?t=11112
i would like to start this user-extension, since it will not get part of the ext core for now.
i am hoping, that some users of the community will participate =)
project-roadmap:
1) first of all, it is important to detach and retach tabpanelItems
2) extending the tabpanel class, so that tabpanelItems get dragzones
3) making tabpanels to dropzones with animation like in grid-headers (small arrows between tab-buttons)
4) routines for sorting tabs (insert new tab at position x of y items)
5) putting it all together
the start
ok, lets get an easy testing-case. i would like a borderlayout and a layoutDialog, both with a center-region. these center-regions display tabs (have tabpanels). for the grids, i use a contructor class. so, here's the simplified syntax:
layout = new Ext.BorderLayout(document.body, {...,
center: {
titlebar: true,
autoScroll:true,
closeOnTab: true,
alwaysShowTabs: true
}
});
grid1 = new GridClass('home');
homeGrid = new Ext.GridPanel(grid1.grid, {title: 'Home', fitToFrame: true, closable: false});
layout.add('center', homeGrid);
centerRegion = layout.getRegion('center');
centerPanel = centerRegion.getTabs();
centerPanel.addTab("tabId2", "new tab", "some Content");
on an event, like button-click, we do create the new layoutDialog:
function openGridDialog () {
gridDialog = new Ext.LayoutDialog(...,
center:{
alwaysShowTabs: true
}
});
diaLayout = gridDialog.getLayout();
diaLayout.beginUpdate();
diaHomeGrid = new Ext.GridPanel(grid1.grid, {autoCreate:true,
title: 'Home', fitToFrame: true, closable: false});
diaLayout.add('center', diaHomeGrid); //lets keep it easy, this is the first tab with index 0
}
so, we created a new gridpanel, with an already existing grid.
this will detach the dom-container-element of the grid of the first gridPanel and attach it to the gridpanel in the layoutDialog. works fine.
the next step is bringing the grid back to the borderlayout:
function = restoreGrid () {
centerPanel.getTab(0).bodyEl.appendChild(grid1.grid.getGridEl().dom); //this line took tons of time =)
centerPanel.getTab(0).setHidden(false);
gridDialog.hide();
}
this demo is supposed to hide a tab, so, if you do detach and retach it, it will be displayed at the same position like it was before! we could make it optional to chose, if the tab should be inserted at the "end" of the tabPanel -> right side. this would need to remove the tab and insert a new one, atm impossible due to bug 1.
restoreGridDialogCategory () is a workaround for sure! this method only works fine, this the grid never looses the resize-listeners it has gotten by creating the first gridpanel. though it does work nice this way (except it has the resize-listeners of the dialog too...).