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

Default sort doesn't work with "deep" properties #181

Closed
ashleahhill opened this issue Oct 4, 2016 · 2 comments · Fixed by #191
Closed

Default sort doesn't work with "deep" properties #181

ashleahhill opened this issue Oct 4, 2016 · 2 comments · Fixed by #191

Comments

@ashleahhill
Copy link
Contributor

ashleahhill commented Oct 4, 2016

I'm submitting a ...

[ ] bug report => search github for a similar issue or PR before submitting
[x] feature request
[ ] support request => Please do not submit support request here

Current behavior
When you specify a "deep" property as the prop for a column:

new TableColumn({
    name: 'Cylinders',
    prop: 'engine.cylinders'
}),

or

            <datatable-column name="Cylinders" prop="engine.cylinders">
              <template let-value="value">
                {{value}}
              </template>
            </datatable-column>

Sort malfunctions, the entire data set is not sorted.

Expected behavior
All rows are sorted based on the value for the column. This is the behavior for rows that use a "shallow" property

Reproduction of the problem
http://plnkr.co/edit/9Eug63qi775HVCMe3BhO?p=preview

  1. On either the "Expressive: Cars" tab or the "Templated: Cars" tab, try to sort by Formation
  2. See that the sort does not work.
  3. On either the "Expressive: Cars" tab or the "Templated: Cars" tab, try to sort by Color
  4. See the the sort does work

What is the motivation / use case for changing the behavior?
I need to sort on deep properties,

Since its trivial (from the usage standpoint) to display these properties using the prop input, it seems like sorting by them should be supported by the default sort

Please tell us about your environment:
Windows
VSCode
Node
Webpack Dev Server

  • Table version: 0.7.x
    0.9.2
  • Angular version: 2.0.x
    @angular/core@2.0.1
  • Browser:
    Only tried in Chrome
  • Language:

TypeScript@2.0.3

@amcdnl
Copy link
Contributor

amcdnl commented Oct 6, 2016

We probably just need to apply similar code as this does - https://github.com/swimlane/angular2-data-table/blob/master/src/components/body/body-cell.component.ts#L34 ... Can you PR that?

ashleahhill added a commit to ashleahhill/angular2-data-table that referenced this issue Oct 8, 2016
ashleahhill added a commit to ashleahhill/angular2-data-table that referenced this issue Oct 8, 2016
@ashleahhill
Copy link
Contributor Author

@amcdnl,
Submitted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants