Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Re : Ignore attribute (of Observe type) while serialization

$
0
0
This solution (return undefined) doesn't work if attribute is Observe (or Observe.List) as it seems that this serialize function is not called for Observes at all (as they have its own).

What can be other solution? I believe it is common situation when you don't want to send unnecessary fields to server. For example, you don't need it to be sent to server when object is saved when: 
1) you use working  property 'selected' or 'active' on Observe to identify that it is selected in the interface, . 
2) you have "readonly" fields that come from server and are not need to be send back.

Small "exessive" fields is ok, server "filter" will ignore it, but some times there are big nested objects that you actually ineffective to send over network if you really don't need them to be saved.

I could also override serialized method on Observe that that I don't want to be send, but it is universal and cumbersome solution, for me it woulbe better to have some static array of attibutes that should be ignored while serialization:

  1. ignoreSerialize: ['birthday'..]
or instruct serialize procedure in some other declarative way.


How do you solve this?



Viewing all articles
Browse latest Browse all 3491

Trending Articles