-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
Change defaultBinding on dataset property in aurelia-slickgrid custom element #42
Comments
I'm not sure that you can go with a You can give it a try, I might be wrong but I thought |
it should still work. I think the two way means that if you reset the dataset to something else it changes in the view model too. Give it a try and let me know your result when you have a chance, the change would be: - @bindable({ defaultBindingMode: bindingMode.twoWay }) dataset: any[];
+ @bindable dataset: any[]; if you do discover a potential issue let me know and i can look at it, or this can just be added to the documentation. |
Well actually, the Service is probably doing the work, not the binding. So yeah you're probably right. What benefit will that give us? Performance? Anyhow, can you make sure that the Example 11 still works after changing that. If that is ok, then I don't mind going ahead. We could also include it in the next upcoming release, if you have time to create PR |
there are two benefits i can think of
@computedFrom('elements')
get editUrls() {
return this.elements.map(e => ({
...e,
editUrl: this.router.generate('component-edit', { id: e.id })
}));
} Example 11 does work, but I will be sure to test the other examples. I will submit a PR if you think this is helpful. EDIT or I can just update the documentation with a "how to" if someone wants to do this? I'll let you decide. |
As long as all examples still works, I'm all good with it and yes I know we might not visually see a boost but it will still be there, less I assume you are using the grid without Updating wikis are always good, we can always refer to them if any questions are brought up and these are all helpful. I often go back and read my own wikis, to know how I use things lol. The grid now has so many features, wikis are the best to keep track and be helpful to users. EDIT |
i agree about wikis, I will do some thorough testing the best I can before making this change. |
ok when did u plan to have a PR for this? I was planning a release by tomorrow evening, should I wait for it or go ahead with a release tomorrow? By the way, I'm going in vacation starting Saturday morning on the 14th. You'll be on your own after (for 3 weeks that is) :P |
Go ahead and release, I want to make sure I test this enough since it is a small change that has a big impact. Enjoy your much deserved vacation! I do not think I will need to release anything new while you are gone. From what I have seen so far today since I am working on the grid, it has everything I need. |
Just saw
You do not have to use |
Sounds good then |
closed by #65 |
I'm submitting a feature request
current
Please tell us about your environment:
Operating System:
All
Browser:
all
Language:
TypeScript X.X
Current behavior:
AureliaSlickgridCustomElement has a defaultBinding of
twoWay
on thedataset
property in https://github.com/ghiscoding/aurelia-slickgrid/blob/master/aurelia-slickgrid/src/aurelia-slickgrid/aurelia-slickgrid.ts#L70Expected/desired behavior:
What is the expected behavior?
Do not specify a default binding, let it "default" to aurelia's default of
oneWay
What is the motivation / use case for changing the behavior?
I do not think we need the overhead of
bindingMode.twoWay
for thedataset
property. The custom aurelia-slickgrid element will never update the dataset, but only get updates from the view model. Besides the slight overhead, there can be issues as I ran into. If a user is using the defaultdataset.bind
in a view and thatdataset
is a getter property on the view model, the application will throw this error:ERROR [app-router] TypeError: Cannot set property newDataset of #<Example4> which has only a getter
This issue is probabaly an edge case, but it does produce an Aurelia error that might be hard to debug for users. The work around is to make use
dataset.one-way
in the view, which will override the custom elementsdefaultBinding
, but some users might not realize this error is coming from this library.I can replicate this in example4.ts with the diffs below:
The text was updated successfully, but these errors were encountered: