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

[Feature Request] Emit a 'save' event from the v-edit-dialog component. #3197

Closed
Aps05 opened this issue Feb 6, 2018 · 11 comments
Closed

[Feature Request] Emit a 'save' event from the v-edit-dialog component. #3197

Aps05 opened this issue Feb 6, 2018 · 11 comments
Assignees
Labels
T: enhancement Functionality that enhances existing features

Comments

@Aps05
Copy link

Aps05 commented Feb 6, 2018

New Functionality

It will allow the developer to know when the user has finally finished his editing and will not cancel his changes in the future.

Improvements

Currently you need to create custom buttons with click events to achieve this, which renders the no-button v-edit-dialog obsolete.

Bugs or Edge Cases it Helps Avoid

The return-value.sync props gets updated 'on-change' and not 'on-save' making it impossible (with no custom buttons) to know when the user is done making changes or not. See example pen below which demonstrates the issue when using the return-value.sync alone:
https://codepen.io/anon/pen/qxadqb?editors=1010

@AlexKovynev
Copy link

AlexKovynev commented Feb 6, 2018

+1 My simple validation now broken:( beta.4 is my stable life preserver for now.

@KaelWD KaelWD added this to the Sprint 3 milestone Feb 6, 2018
@johnleider johnleider removed this from the Sprint 3 milestone Feb 7, 2018
@AlexKovynev
Copy link

AlexKovynev commented Feb 7, 2018

Why? Without this edit dialog mostly not useful:(
Ok, i try to emulate large mode myself:(

Will be great return "open" also.

@AlexKovynev
Copy link

AlexKovynev commented Feb 9, 2018

Folks, i was wrong. Save event does not decide anything. VEditDialog mostly proof of concept. Universal decision maybe does not exist at all.

Aim:
1.Validate input
2.Does not save if error, maybe alert some.
3.Every time use new own property ( i don't know how do that, and this is cancel "persistent" property, or maybe generate text-box from component, without any custom slot )

So only "save" does not change anything.

@nekosaur nekosaur added the T: enhancement Functionality that enhances existing features label Feb 12, 2018
@johnleider johnleider removed this from the Sprint 3 milestone Feb 14, 2018
@nothing628
Copy link

same as here. I need a 'save' event to get data that needs updating compared to updating the entire table.

currently i use 'watch' to see the data that needs to update. Please restore the 'save' event

@shirahamax
Copy link

Hi, same as here. I resolve this by using change event in v-text-field. thank you.
https://codepen.io/shirahama-x/pen/BYPdjx

@smxsm
Copy link

smxsm commented Feb 26, 2018

Yep, same here - all my inline-editing functionality was broken after the update ... why were the events removed from the component?

@smxsm
Copy link

smxsm commented Mar 4, 2018

I would file that as a bug since it was working before and now it seems just accidentially gone, right?

@robertsLando
Copy link

I have solved by simple using @keyup.enter="updateName(props.item._id, props.item.name)" on input text field:

<v-text-field
   slot="input"
   label="Edit"
   v-model="props.item.name"
   single-line
   counter
   @keyup.enter="updateName(props.item._id, props.item.name)"
    :rules="[required]"
>
</v-text-field>

@aquintero
Copy link

aquintero commented Mar 31, 2018

@robertsLando
I don't think that works without native (@keyup.native.enter). It also might be better to use @keydown.native.enter considering the default behavior to is to hide the textbox on keydown not keyup.

@tvkit
Copy link

tvkit commented Apr 1, 2018

For the time being, here's how I'm hooking the save call in a typescript project where item.id is guaranteed to be unique:

<v-edit-dialog :ref="hookSave(item)"  other stuff>
 ...
</v-edit-dialog>
  hookSave(item: any) {
    const id = `item_${item.id}`;
    const $refs = this.$refs;
    setTimeout(() => {
      const $ref = $refs[id] as any;
      if (!$ref.oldSave) {
        $ref.oldSave = $ref.save;
      }
      $ref.save = (value: string) => {
        $ref.oldSave(value);
        this.internalSave(item);
      };
    });
    return id;
  }

I noticed the returnable mixin has the following, but I'm not sure how to capture the emitted event.

  methods: {
    save (value) {
      this.originalValue = value
      this.$emit('update:returnValue', value)
      this.isActive = false
    }
  }

@KaelWD
Copy link
Member

KaelWD commented Apr 1, 2018

@tvkit :return-value.sync="someData"

jacekkarczmarczyk added a commit that referenced this issue Jun 11, 2018
* fix (v-edit-dialog): restores **save** event

fixes #3197

* fix(VEditDialog): restored open/close/cancel events
@lock lock bot locked as resolved and limited conversation to collaborators Jun 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
T: enhancement Functionality that enhances existing features
Projects
None yet
Development

No branches or pull requests