Skip to content

ctx.nodeSlots()

ctx.nodeSlots — Extensions > Layout context > Columnar reads. Cytoscape.js signatures, parameters and return contract.

ctx.nodeSlots — Extensions › Layout context › Columnar reads

Preview · Extensions › Layout context › Columnar reads

Read in the complete API reference · All API members

// The slots to lay out: the scope's unlocked leaves, plus a collapsed parent when no scoped node lies below it
ctx.nodeSlots(): number[]

The slots to lay out: the scope's unlocked leaves, plus a collapsed parent when no scoped node lies below it. Locked nodes hold their place; parents with scoped descendants derive from those descendants. Scope order.

Returns number[]

the slots to place, in exactly cy.nodes() order — which is load-bearing rather than incidental, since grid and circle assign positions by index, so a different enumeration order is a different layout

Example

// Inside a custom layout, ctx is supplied by the library.
cy.layout({ impl: { run(ctx) {
console.log(ctx.nodeSlots()); // [0, 1, 2]
} } }).run();

Example graph and handle setup