hjalmers / angular-generic-table

A generic table for Angular 2+. Generic table uses standard markup for tables ie. table, tr and td elements etc. and has support for expanding rows, global search, filters, sorting, pagination, export to CSV, column clicks, custom column rendering, custom export values.
https://hjalmers.github.io/angular-generic-table/
MIT License
105 stars 55 forks source link

Add ability to set initial state for drilldown component #217

Closed Roesler closed 6 years ago

Roesler commented 6 years ago

I.e. should row be expanded or collapsed by default. rowExpandInitialState isn't working as expected.

image

hjalmers commented 6 years ago

Actually there was a function for this but I noticed it wasn't working anymore due to a change way back so I've updated the function a bit and added another property to gtOptions called rowExpandInitialComponent that you need to set in order to let the table know what component you want to show when you expand the row. Eg.

public options = {
        reportColumnWidth: true,
        rowExpandInitialState: (row) => { return row.name === 'vegetables'; }, // function or boolean
        rowExpandInitialComponent: {
            component: CustomRowComponent, // component to show
            data: (row) => row.drilldown // the data that should be passed to the component
        }
    };`

This will work with the next release (current version i 4.13.0)