wannabegeek / ng2-split-pane

Split View module for Angular 2
MIT License
43 stars 25 forks source link

Mehod to resize the divider #34

Closed aslamkam closed 7 years ago

aslamkam commented 7 years ago

Say you want the divider 200px from the left so that the primary component is 200px wide. i.e. resizeDivider(200)

darinw commented 7 years ago

I 100% agree with this. Would have many advantages!

darinw commented 7 years ago

@aslamkam

FOUND SOLUTION: import {HorizontalSplitPaneComponent} from "ng2-split-pane/lib/horizontal-split-pane.component"; ... in the component you have the split pane inside:

@ViewChild(HorizontalSplitPaneComponent) splitComponent: HorizontalSplitPaneComponent;
public testSizeChange(): void {
    console.log('getTotalSize', this.splitComponent.getTotalSize());
    console.log('getPrimarySize', this.splitComponent.getPrimarySize());
    console.log('getSecondarySize', this.splitComponent.getSecondarySize());

    this.splitComponent.applySizeChange(200) // px of the primary component
  }

there is also a this.splitComponent.dividerPosition(250)

EDIT: the get functions will get height or width depending on the Horizontal vs Vertical

aslamkam commented 7 years ago

Thanks a lot for showing me the functions. Since the docs didn't contain these functions, I assumed they didn't exist.