-
Notifications
You must be signed in to change notification settings - Fork 422
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
can.Model.List doesn't fire the change event on the expando properties #129
Comments
Are you changing those properties? I tend not to. Plus, list doesn't support this. |
Hi Justin, I agree with you. But if a property can be accessed via .attr then it can be set too, which means people expect it to be able to use it in their EJS templates for live bindings. For eg: If i manually did employee.attr('count', 500) it does fire the change event. |
Can those properties be accessed via .attr ? |
YEP. eg: The expando properties can be accessed either via employee.count or employee.attr('count') |
@rajaravipati I'm not sure I understand your problem. This seems to be working:
|
@daffl You are right & thats what i said in my earlier comment :) But thats not the way the expando properties gets assigned in the source code. Please see line no 732 (res[prop] = val;) in https://github.com/jupiterjs/canjs/blob/master/model/model.js I have created the following http://jsfiddle.net/vAv2t/ to play with. If you click the 'refresh data' button the data array does get updated but not the count property which is updated with a random number every time the findAll method is called. So the EJS template doesn't update due to the change event not firing for each expando property. Check the console.log messages. |
Ah got it! Problem is, that |
# By Eli Morris-Heft (4) and others # Via Josh Dean (3) and others * origin/master: Undo pull request exposing .abort, due to failing tests. Added inlineEJS.html to test issue #108. Added a test for #103. Use .attr for model list expando properties. Closes #129 provides Observe.startBatch Observe.stopBatch and Observe.triggerBatch Update to Element.NativeEvents to include hashchange and popstate. Added a test for indirectly recursive EJS templates. (Ref: Issue #103.) Added quoted values to Observe.delegate selectors. adding a test for #126 makes Lists be able to create their associated Observe constructor issue #130 - pass jQuery a node list instead of a fragment Return the original promise so abort() is not lost. add a test for ajaxMethod.abort() expose abort() method on Model calls (if exists)
http://donejs.com/docs.html#!can.Model.static.models
In this case, models will return a can.Model.List of instances found in data, but with additional properties as expandos on the list:
The change event should fire for each changed expando property as all the expando properties can be accessed via the .attr method.
The text was updated successfully, but these errors were encountered: