AboutSupportDeveloper GuideVersion 47.154.100.2
OpenFin JavaScript API
    Preparing search index...

    Interface ColumnOrRow

    A ColumnOrRow is used to manage the state of Column and Rows within an OpenFin Layout.

    interface ColumnOrRow {
        type: "row" | "column";
        createAdjacentStack(
            views: Partial<ViewOptions>[],
            options: { position?: LayoutPosition },
        ): Promise<TabStack>;
        exists(): Promise<boolean>;
        getAdjacentStacks(edge: LayoutPosition): Promise<TabStack[]>;
        getContent(): Promise<(TabStack | ColumnOrRow)[]>;
        getParent(): Promise<TabStack | ColumnOrRow | undefined>;
        isRoot(): Promise<boolean>;
    }

    Hierarchy

    • LayoutNode
      • ColumnOrRow
    Index
    type: "row" | "column"

    The type of this ColumnOrRow. Either 'row' or 'column'.

    • Experimental

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

      Known Issue: If the number of views to add overflows the tab-container, the added views will be set as active during each render, and then placed at the front of the tab-stack, while the underlying order of tabs will remain unchanged. This means the views you pass to createAdjacentStack() may not render in the order given by the array. Note: This issue does not occur when using tabOverflowBehavior: 'scroll' in the layout configuration.

      Parameters

      • views: Partial<ViewOptions>[]

        The views that will populate the new TabStack.

      • options: { position?: LayoutPosition }

        Additional options that control new TabStack creation.

      Returns Promise<TabStack>

      The newly-created TabStack.

      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'
      let stackFrom = await columnOrRow.createAdjacentStack(viewsToAdd, { position: 'right' });
      // Or
      let newStack = await stack.createAdjacentStack(viewsToAdd, { position: 'right' });
      console.log(`A new TabStack created to the right has ${newStack.length} views in it`);
    • Checks if the TabStack or ColumnOrRow exists

      Returns Promise<boolean>

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

      const stack = await fin.me.getCurrentStack();
      // Retrieves the parent ColumnOrRow
      const columnOrRow = await stack.getParent();
      let exists = await stack.exists();
      // or
      let exists = await columnOrRow.exists();
      // The entity exists: true
      console.log(`The entity exists: ${exists}`);
    • Experimental

      Retrieves the adjacent TabStacks of the given TabStack or ColumnOrRow.

      Parameters

      • edge: LayoutPosition

        Edge whose adjacent TabStacks will be returned.

      Returns Promise<TabStack[]>

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

      const stack = await fin.me.getCurrentStack();
      const columnOrRow = await stack.getParent();
      // Possible position inputs: 'right' | 'left' | 'top' | 'bottom'
      let rightStacks = await columnOrRow.getAdjacentStacks('right');
      let leftStacks = await columnOrRow.getAdjacentStacks('left');
      // or
      let rightStacks = await stack.getAdjacentStacks('right');
      let leftStacks = await stack.getAdjacentStacks('left');

      console.log(`The entity has ${rightStacks.length} stacks to the right, and ${leftStacks.length} stacks to the left`);
    • Retrieves the content array of the ColumnOrRow

      Returns Promise<(TabStack | ColumnOrRow)[]>

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

      const stack = await fin.me.getCurrentStack();
      // Retrieves the parent ColumnOrRow
      const columnOrRow = await stack.getParent();

      // returns [TabStack]
      const contentArray = await columnOrRow.getContent();
      console.log(`The ColumnOrRow has ${contentArray.length} item(s)`);
    • Retrieves the parent of the TabStack or ColumnOrRow

      Returns Promise<TabStack | ColumnOrRow | undefined>

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

      const stack = await fin.me.getCurrentStack();
      // Retrieves the parent ColumnOrRow
      const columnOrRow = await stack.getParent();

      // undefined if entity is the root item
      let parent = await columnOrRow.getParent();
      // or
      let parent = await stack.getParent();
    • Checks if the TabStack or ColumnOrRow is the root content item

      Returns Promise<boolean>

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

      const stack = await fin.me.getCurrentStack();
      const isRoot = await stack.isRoot();
      // The TabStack is root: false
      console.log(`The TabStack is root: ${isRoot}`);

      // Retrieves the parent ColumnOrRow
      const parent = await stack.getParent();
      const parentIsRoot = await parent.isRoot();
      // The parent ColumnOrRow is root: true
      console.log(`The parent ColumnOrRow is root: ${parentIsRoot}`);