Skip to content
This repository has been archived by the owner on Aug 19, 2024. It is now read-only.

defaultColDef doesn't work when columns defined in html #24

Open
ShaunVanDyk opened this issue Jan 29, 2018 · 1 comment
Open

defaultColDef doesn't work when columns defined in html #24

ShaunVanDyk opened this issue Jan 29, 2018 · 1 comment

Comments

@ShaunVanDyk
Copy link

ShaunVanDyk commented Jan 29, 2018

I'm submitting a ... (check one with "x")

[ x ] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/ceolter/ag-grid-aurelia/blob/master/CONTRIBUTING.md#question

Current behavior
defaultColDef on GridOptions doesn't apply when defining columns in html templates using ag-grid-column. If columns are defined in typescript / js on the GridOptions, then the defaults get applied fine.

Expected behavior
defaultColDef on the grid options should apply the properties to the columns if the columns themselves don't define that option. For example, if defaultColDef.editable = false, and the column doesn't define the property, then it should be false. If a column sets editable = true, then only that column will be editable, the rest will be readonly.

Minimal reproduction of the problem with instructions
** Doesn't work: **

<!-- html -->
<ag-grid-aurelia class="ag-theme-bootstrap" grid-options.bind="defaultGridOptions"
        row-data.bind="rowData" style="height: 350px;">

        <!-- This column should be editable, as it defines the property so should override the default -->
        <ag-grid-column header-name="Code" field="code" width.bind="95" editable.bind="true">
        </ag-grid-column>

        <!-- Shouldn't be editable, doesn't define editable so should pick up the default -->
        <ag-grid-column header-name="Description" field="description" width.bind="150">
        </ag-grid-column>
</ag-grid-aurelia>
<!-- ts -->
private defaultGridOptions: GridOptions = <GridOptions>{
        defaultColDef: {
            editable: true
        }
    };
private rowData = [
    { code: "a", description: "apple" },
    { code: "b", description: "banana" }
];

** Works: **

<!-- html -->
<ag-grid-aurelia class="ag-theme-bootstrap" grid-options.bind="defaultGridOptions"
        row-data.bind="rowData" style="height: 350px;">
</ag-grid-aurelia>
<!-- ts -->
private defaultGridOptions: GridOptions = <GridOptions>{
        defaultColDef: {
            editable: true
        },
        colDefs: [
            { headerName: "Code", field: "code", editable: true },
            { headerName: "Description", field: "description" }
        ]
    };

private rowData = [
    { code: "a", description: "apple" },
    { code: "b", description: "banana" }
];

Please tell us about your environment:
Windows 10, VSCode, npm, aurelia-cli

  • ag-grid-aurelia version: 2.0.X
    Tried in both 15 & 16

  • ag-Grid/ag-Grid-Enterprise version: 2.0.X
    N/A

  • Aurelia version: 2.0.X
    1.1.4

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
    Tested in Chrome & Edge

  • Language: [all | TypeScript X.X | ES6/7 | ES5]
    Typescript 2.6.1

ShaunVanDyk pushed a commit to ShaunVanDyk/ag-grid-aurelia that referenced this issue Feb 6, 2018
Don't map column properties which are undefined. This prevents default column settings from being applied within the grid (because the property is present), and stops attributes like type from working. This pr is a fix for issue [ag-grid#24](ag-grid#24)
@ShaunVanDyk
Copy link
Author

Adding a "Type" also doesn't work via templating, but it does when defining in the code behind. The pull request fixes that as well.

ShaunVanDyk pushed a commit to ShaunVanDyk/ag-grid-aurelia that referenced this issue Feb 12, 2018
Remove editor action from changing editable of the column def. Doing this prevents default column editable and column types editable properties from being applied, breaking the default behaviour of ag-grid
This pr is a fix for issue [ag-grid#24](ag-grid#24)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant