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

[v-data-table] Can't search by attribute which include dot character #4586

Closed
ittus opened this issue Jul 12, 2018 · 2 comments · Fixed by #5090
Closed

[v-data-table] Can't search by attribute which include dot character #4586

ittus opened this issue Jul 12, 2018 · 2 comments · Fixed by #5090
Labels
T: bug Functionality that does not work as intended/expected

Comments

@ittus
Copy link
Contributor

ittus commented Jul 12, 2018

Versions and Environment

Vuetify: 1.1.4
Vue: 2.5.16
Browsers: Chrome Version 67.0.3396.99 (Official Build) (64-bit)
OS: Mac OS 10.13.5

Steps to reproduce

  1. Create an array of items which has dot in property name.
    For example:
        {
          value: false,
          '.name': 'Frozen Yogurt',
          calories: 159,
          fat: 6.0,
          carbs: 24,
          protein: 4.0,
          iron: '1%'
        }
  1. Pass items array to v-data-table. Can't search by .name attribute

Expected Behavior

Can search by .name attribute

Actual Behavior

Can't search

Reproduction Link

https://codepen.io/ittus/pen/wxBLgV
(Can't search by .name property)


Additional Comments:

  • I think because of getObjectValueByPath, we can't get object['.name'] value
  • A popular use case is when using with vuefire, .key attribute is exist.
    My workaround is using computed attribute:
computed: {
   formatItems: function() {
      return this.items.map(item => {
           return {
              ...item,
             key: item['.key']
           }
      })
   }
}
@ittus
Copy link
Contributor Author

ittus commented Jul 12, 2018

I think we can add by passing fallback parameter to

return items.filter(item => props.some(prop => filter(getObjectValueByPath(item, prop), search)))

return items.filter(item => props.some(prop => filter(getObjectValueByPath(item, prop, item[prop]), search)))

@nekosaur nekosaur added the T: bug Functionality that does not work as intended/expected label Jul 14, 2018
@KaelWD
Copy link
Member

KaelWD commented Aug 10, 2018

#1823, not sure what those "breaking issues" would be though.

nekosaur pushed a commit that referenced this issue Oct 26, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jan 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
T: bug Functionality that does not work as intended/expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants