Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(grid): gridHeight & gridWidth not set, closes #35 #40

Merged
merged 1 commit into from
Apr 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div id="slickGridContainer-${gridId}" class="gridPane">
<div id.bind="gridId" class="slickgrid-container" style.bind="style">
<div id="slickGridContainer-${gridId}" class="gridPane" css.bind="gridStyleWidth">
<div id.bind="gridId" class="slickgrid-container" style="width: 100%" css.bind="gridStyleHeight">
</div>

<slick-pagination id="slickPagingContainer-${gridId}" if.bind="showPagination" asg-on-pagination-changed.delegate="paginationChanged($event.detail)"
Expand Down
21 changes: 11 additions & 10 deletions aurelia-slickgrid/src/aurelia-slickgrid/aurelia-slickgrid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,10 @@ export class AureliaSlickgridCustomElement {
private _dataset: any[];
private _eventHandler: any = new Slick.EventHandler();
gridStateSubscriber: Subscription;
gridHeightString: string;
gridWidthString: string;
gridStyleHeight: { height: string; };
gridStyleWidth: { width: string; };
localeChangedSubscriber: Subscription;
showPagination = false;
style: any;

@bindable({ defaultBindingMode: bindingMode.twoWay }) element: Element;
@bindable({ defaultBindingMode: bindingMode.twoWay }) dataset: any[];
Expand All @@ -75,7 +74,7 @@ export class AureliaSlickgridCustomElement {
@bindable() gridId: string;
@bindable() columnDefinitions: Column[];
@bindable() gridOptions: GridOption;
@bindable() gridHeight = 100;
@bindable() gridHeight = 200;
@bindable() gridWidth = 600;
@bindable() pickerOptions: any;

Expand Down Expand Up @@ -186,10 +185,14 @@ export class AureliaSlickgridCustomElement {
// get the grid options (priority is Global Options first, then user option which could overwrite the Global options)
this.gridOptions = { ...GlobalGridOptions, ...binding.gridOptions };

this.style = {
height: `${binding.gridHeight}px`,
width: `${binding.gridWidth}px`
};
if (!this.gridOptions.enableAutoResize) {
this.gridStyleWidth = {
width: `${this.gridWidth}px`
};
this.gridStyleHeight = {
height: `${this.gridHeight}px`
};
}

// Wrap each editor class in the Factory resolver so consumers of this library can use
// dependency injection. Aurelia will resolve all dependencies when we pass the container
Expand Down Expand Up @@ -395,8 +398,6 @@ export class AureliaSlickgridCustomElement {
if (options.autoFitColumnsOnFirstLoad && typeof grid.autosizeColumns === 'function') {
grid.autosizeColumns();
}
} else {
this.resizer.resizeGrid(0, { height: this.gridHeight, width: this.gridWidth });
}
}

Expand Down