Hi,
I found some bugs in store.js and model.js file.
When model store remove callback fired,id argument is an event object. But it used like a removed model instance. And id property is not checked by Model.Store.id . So this code:
- remove : function(id){
- if(id.id !== undefined){
- id = id.id;
- }
changed to :
- remove: function(ev,id){
- var idProp = this.id;
- if(id[idProp] !== undefined){
- id = id[idProp];
- }
- ......
In model.js file,model serialize property should be extended like convert property. I think add this code after convert extending :
- //add missing converters
- if ( superClass.convert != this.convert ) {
- this.convert = extend(superClass.convert, this.convert);
- }
- //add missing serializes
- if ( superClass.serialize != this.serialize ) {
- this.serialize = extend(superClass.serialize, this.serialize);
- }
or
- each(["convert","serialize"],function(i,name){
- if (superClass[name] != self[name] ) {
- self[name] =extend(superClass[name], self[name]);
- }
- })
And I don't find any documentation about that. I used it like that in my tile model:
- attributes:{
- p:'vector'
- },
- convert:{
- vector:function(raw){
- if($.isArray(raw))
- return new $.Vector(raw[0]*LAT,raw[1]*LNG);
- else
- return this.serialize['default'](raw,'vector');
- }
- },
- serialize:{
- vector:function(val){
- return [val.left()/LAT,val.top()/LNG];
- }
- },
Finally when I updated one property of a model, update function sent to server all properties of a model. Why? Is this bug?
I think this bug (if it is a bug) is related to makeRequest (
line94 )and model serialize functions(
line1538-1544 ).
Thanks,
Safak