Tutorial: ColumnOrRow.createAdjacentStack

ColumnOrRow.createAdjacentStack

Creates a new TabStack adjacent to the given ColumnOrRow. Inputs can be new views to create, or existing views.

Create an adjacent tab stack

if (!fin.me.isView) {
    throw new Error('Not running in a platform View.');
}

const stack = await fin.me.getCurrentStack();
const columnOrRow = await stack.getParent();

// Create view references by supplying a 'name' and 'url'
const views = [
    // if 'name' is undefined, one will be generated
    // if 'url' is undefined, it will default the view URL to 'about:blank'
    { name: 'google-view', url: 'http://google.com/'},
    { name: 'of-developers-view', url: 'http://developers.openfin.co/'},
];

// Create a view beforehand to be included in the new tab stack
const outsideView = await fin.View.create({
    name: 'outside-bloomberg-view',
    url: 'https://bloomberg.com/',
    target: fin.me.identity,
});

// Views to add can be identities, or the reference views mentioned above
const viewsToAdd = [outsideView.identity, ...views];

// Possible position inputs: 'right' | 'left' | 'top' | 'bottom'
const newStack = await columnOrRow.createAdjacentStack(viewsToAdd, { position: 'right' });
console.log(`A new TabStack created to the right has ${newStack.length} views in it`);