charlespockert / aurelia-bs-grid

Aurelia and Bootstrap powered datagrid control
MIT License
45 stars 21 forks source link

Main table sub table #63

Closed eaidland closed 8 years ago

eaidland commented 8 years ago

Hi @charlespockert !

Not an issue, but didn't know where else to write the question.

Is it possible to have a main table and a sub table. Where the sub table is shown and populated only when one selects a row in the main table?

Thanks :+1:

charlespockert commented 8 years ago

It's possible in a few ways. A simple way is to bind selectedItem in the first grid to a property on your viewmodel to track if something is selected.

If you make the property @bindable you can subscribe to changes using Aurelia's change notification <propertyname>Changed(newValue, oldValue)

When this changes you can then call refresh on the 2nd grid and ensure the read method gets the correct parameters (the read method can look at the selected item property for the first grid to determine what to load)

eaidland commented 8 years ago

What about row click trigger? Bad Idea?

     <grid-row click.trigger="$parent.$parent.getSelectedProjectChildren($item)">
charlespockert commented 8 years ago

That will also work! Bit more wordy than binding selected-item though :)

eaidland commented 8 years ago

Will rewrite code tomorrow. @party :)

Sendt fra min iPhone

Den 3. okt. 2015 kl. 19.31 skrev Charles Pockert notifications@github.com:

That will also work! Bit more wordy than binding selected-item though :)

— Reply to this email directly or view it on GitHub.