Child pages
  • Foundset property type

Versions Compared

Key

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

...

Code Block
languagejs
titleAdding a change listener (for incomming changes from server)
var l = function(changes) {
    // check to see what actually changed and update what is needed in browser
};
$scope.model.myFoundset.addChangeListener(l);

If you are using foundset linked properties with your foundset property you might want to add the listener as shown here.

The "changes" parameter above is a javascript Object containing one or more keys, depending on what changes took place. The keys specify the type of change that happened; they can be any of the constants starting with NOTIFY_... from "$foundsetTypeConstants" service. The value gives any extra information needed for that type of change. Here is what "changes" can contain (one or more of the keys/values listed below):

...

Code Block
languagejs
"myFoundset": "foundset",
"myconfiguration": "MyConfig", // or:
"myconfigurations": "MyConfig[]"
(...)
"types": {
    "MyConfig": { 
        "mydataprovider" : { "type" : "dataprovider", "forFoundset": "myFoundset"}
        "mytagstring" : { "type" : "tagstring", "forFoundset": "myFoundset"}
    }
}

Anchor
foundsetListenerAndFoundsetLinkedProperties
foundsetListenerAndFoundsetLinkedProperties

Info
titleFoundset change listener & other foundset linked properties (starting with 8.2)

In case you want to use a foundset property type change listener (for incomming changes from server) combined with other foundset linked properties such as dataproviders with "forFoundset", a change of a row on server will send changes both to the foundset property and to the dataprovider properties linked to that foundset. In order to make sure that your foundset notification update code executes after all property changes have been applied (so the dataprovider properties are also up-to-date) you can use:

Code Block
var l = function(changes) {
    // wait for all incoming changes to be applied to properties first
    $webSocket.addIncomingMessageHandlingDoneTask(function() {
        // now check to see what actually changed and update what is needed in browser
        // because even other "forFoundset" properties are up-to-date
    }
};
$scope.model.myFoundset.addChangeListener(l);

...