Lucio Flores
2014-08-05T20:56:38Z

Temporizador para recorrer Paneles a partir de un TreePanel ExtJs

| var fn_addTab = function (vc_tab, vc_title, vc_url) {
| var tabPanel = Ext.getCmp("tbConfig");
| var tab = tabPanel.getComponent(vc_tab);
|
| if (!tab) {
| tab = tabPanel.add({
| id: vc_tab,
| title: vc_title,
| closable: true,
| autoScroll: false,
| layout: {
| type: 'hbox',
| aling: 'stretch',
| pack: 'start',
| },
| loader: {
| url: vc_url,
| renderer: 'frame',
| loadMask: {
| showMask: true,
| msg: 'Loading'
| }
| }
| });
| }
| else {
| tab.load();
| }
| tabPanel.setActiveTab(tab);
| };
| Ext.onReady(function () {
| if ('@user.vc_nombre' == "logout") {
| window.top.location.href = 'Access';
| }
| });
|
|
| var arrayIDNodes = []; //A rellenar mediante ajax
| var arrayUrl = [];//A rellenar mediante ajax
|
| var i = 0;
|
| var Timer = setInterval(function () {
| fn_addTab(arrayIDNodes[i], arrayIDNodes[i], arrayUrl[i]);
| var record = App.MenuTreePanel.getStore().getNodeById(arrayIDNodes[i] + "_sub");
| App.MenuTreePanel.getSelectionModel().select(record);
| i++;
| if (i >= 3) {
| i = 0;
| }
| }, 3000);
|
|
| var StopTimer = function () {
| var value = App.checkTimer.getValue();
| if (value) {
| window.clearInterval(Timer);
| }
| else {
| Timer = setInterval(function () {
| fn_addTab(arrayIDNodes[i], arrayIDNodes[i], arrayUrl[i]);
| var record = App.MenuTreePanel.getStore().getNodeById(arrayIDNodes[i] + "_sub");
| App.MenuTreePanel.getSelectionModel().select(record);
| i++;
| if (i >= 3) {
| i = 0;
| }
| }, 3000);
| }
| };
| var ChangeNode = function () {
| fn_addTab(arrayIDNodes[i], arrayIDNodes[i], arrayUrl[i]);
| var record = App.MenuTreePanel.getStore().getNodeById(arrayIDNodes[i] + "_sub");
| console.log(record);
| App.MenuTreePanel.getSelectionModel().select(record);
| i++;
| };