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

Add option to remove two way data binding in 2.x #121

Closed
Robdel12 opened this issue Jul 12, 2016 · 5 comments · Fixed by #125
Closed

Add option to remove two way data binding in 2.x #121

Robdel12 opened this issue Jul 12, 2016 · 5 comments · Fixed by #125
Assignees
Milestone

Comments

@Robdel12
Copy link
Collaborator

Version of x-select:

2.x

Expected Behavior

To change the selected option in x-select and not mutate the underlying value without an action.

Actual Behavior

It mutates the value of x-select without an action.

Description

For emberx-select v2.2.0 we would like to provide an option to remove the two way data binding we do by default. This will set us up for v3.0.0 that will permantly remove two way data binding.

Approach

I think we can wrap a simple conditional around this line.

Testing

Since the updating of the value is already abstracted out into its own method we can stub it in tests and make sure it's being called when two way data binding is enabled. And we can also assert that it doesn't get called when it's disabled.

cc: @dgaus

@Robdel12
Copy link
Collaborator Author

@dgaus 2.2.0 has been released!

@dgaus
Copy link

dgaus commented Jul 19, 2016

I am testing the new version but it doesn't seem to work as intended. It seems that if _this.updateValue() is not called, the action is called with the old value instead of the new selection.

@Robdel12
Copy link
Collaborator Author

Robdel12 commented Jul 19, 2016

You are right, what a massive glaring bug :/ I'm sorry. I'm going to try and fix this by tonight!

Edit: going to create a new issue for this.

@Robdel12 Robdel12 reopened this Jul 19, 2016
@dgaus
Copy link

dgaus commented Jul 19, 2016

No worries. I did a sort of fix on dgaus@50b7c33 , I'm not too happy about it, but perhaps it's useful to you.
The workflow I'm trying to achieve is:

  • User changes selection
  • A prompt is displayed, "are you sure?"
  • If user clicks yes -> update the model and save (this is achievable)
  • If user clicks no -> ignore the change (ok) and set back the selection to the original one (I don't know how to do this, since now the value is not associated with the current choice)

As a workaround I'm using model.rollbackAttributes, but I would rather do it using one-way binding.

@Robdel12 Robdel12 modified the milestones: v2.2.1, v2.2.0 Jul 19, 2016
@Robdel12
Copy link
Collaborator Author

Should actually be fixed #132!

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