Child pages
  • Custom object property types

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The custom object property type can be used by web components to logically group a number of subproperties sub-properties (that can be of different types) for easier usage.

Such custom object types are able to send granular updates between server and client. For example if you change from Rhino one subproperty value (or for more complex element property types - such as 'component' type - if something changes in only one of the subproperties) then only the change is sent over to the browser/client instead of the whole custom object (and the other way around - a subproperty change on client doesn't send the full object, just the change to server).

...

Code Block
languagejs
    "model": {
        (...)
        "myPerson": "person"
		(...)
    },
    (...)
    "types": {
        "person": {
          "firstName": "string",
          "lastName": "string",
          "photo": "dataprovider"
          "styleClass" : { "type": "styleclass",
                           "tags": { "scope" :"design" },
                           "values": ["form-control", "input-sm", "svy-padding-xs"] }
        }
    }
Info

"pushToServer" .spec setting of a custom object property is currently automatically inherited by the sub-properties of that property (so any "pushToServer" setting defined on sub-properties of the array will be ingnored). That means that for example if you define the custom object prop. to be "shallow" watched, all it's sub-properties will be shallow watched. If you don't define pushToServer or define "reject" then the sub-properties of that custom object will not be watched inside the browser and any changes to them will not be sent to the server.

You should not use pushToServer: "deep" on custom object property types, as that will actually add a deep watch on the custom object and any change within a sub-property of that custom object will be interpreted as an custom object prop. change and will send the full custom object value to the server. If you use "shallow" then the changes in custom object sub-properties are watched anyway (so in the end it is similar to a deep watch), so you normally do not need "deep" anyway; "deep" is meant more for properties of types like 'object' where you can have random JSON content that you want to be deep watched (so it sends it's whole value to the server for any change - so without granular updates).

Browser/client side value

...