Child pages
  • Foundset property type

Versions Compared

Key

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

...

A web component might want to work with as many dataproviders available in the viewport as the developer wants. Servoy Developer will allow selecting any number of dataproviders of the foundset to be sent to browser web component property value. For example a component that shows graphical representation of data might allow adding as many 'categories' to it as the developer wants to (each category getting data from one viewport column/dataprovider) .

.spec file

Code Block
"myfoundsetmyFoundset": { "type": "foundset", }

or

Code Block
"myfoundset"dynamicDataproviders": "foundset"true }

So the component has a property called "myfoundset" that it want linked to any foundset chosen in ServoyDeveloper, and it allows the developer to choose any number of dataproviders from the foundset.

...

A web component can specify in it's .spec file that it requires a foundset property and a fixed number of dataproviders from it. The foundset and required dataproviders are then selected by the developer when creating a solution.

.spec file

Code Block
"myfoundsetmyFoundset": { "type": "foundset", "dataproviders": ["firstName", "lastName"] }

...

Other property types can have content that is 'linked' to foundset records in some way. These property types can be configured in the .spec file as shown below - linking to any other property they have defined with 'foundset' type. When they are linked to a foundset, their javascript value in the browser is no longer only one value, but a viewPort of values (or it will also contain a viewPort of values - the exact content is property type specific) - corresponding to the records loaded in the linked foundset property's viewPort.

In this scenario, the viewPort of the foundset value only contains '_svyRowId' if it's own .spec property configuration doesn't list a dynamic or static list of dataproviders ("dataproviders" : [...] or "dynamicDataproviders": true), and the "foundset aware" property type value will have the viewPort contents in it (check each "foundset aware" type to see how that works, as it could differ from type to type).

Component type (child components that are linked to a foundset - for tables, lists, ...) or custom object types built of/containing other "foundset aware" property types (let's call them 'configurations' - can be used to build lightweight pure HTML tables, lists, ...) are the most common uses in this area.

Examples of foundset aware types are 'component', 'dataprovider', 'tagstring'.

.spec file

One child component linked to the foundset:

Code Block
"childElements"myFoundset": "foundset",
"childElement" : { "type" : "component", "forFoundsetTypedPropertyforFoundset": "myfoundsetmyFoundset" }, `

browser js

Then we have to have also a components property that maps on this one:

 

 Then the components dictate which dataproviders will be send over for that foundset selector.

Or we can have by configuration type, so instead of childelements we have:

 

Code Block
"myconfigurations": "MyConfig"
"types": {
    "MyConfig": { 
        "mydataprovider" : { "type" : "dataprovider", "forFoundsetTypedProperty": "myfoundset"}
    }
}

Then the configuration dictates which dataproviders are send over  for that foundset.

In these 2 scenario's the viewport of the foundset only contains the rowid's and the components (childElements) or configuration (myconfigurations) have the viewPort for that row data (we as an example below)

 

Besides these 2 options where which dataproviders are defined by another property the foundset property can also define the dataprovider itself:

Code Block
"myfoundset": {"type":"foundset", "dataproviders":["firstname","lastname"]}

 

Now the foundset itself just specifies what dataproviders it expects in its viewport rows.

The dataproviders will be mapped just like a normal webcomponent, so in the browser value you will have "firstname" and "lastname" and those are filled in on the server side based on the dataprovider they are mapped on in the designer.

Browser value:

Here is a sample of what the value of a 'foundset' typed property contains in the browser - web component model:

Initially the viewPort is an empty array (size 0) and startIndex is 0 as well. Client side JS can watch the value of serverSize and when recods become available it can request the desired Viewport using loadRecordsAsync.

If more records need to be shown besides the already loaded ones use loadExtraRecordsAsync.

Changes made in browser to viewPort.rows data content (so column value modifications) will be sent server-side.

Changes made in browser to selectedRowIndexes content will change selection on server side as well.

Design value (generated visually by form designer and written in .frm file, so Servoy users don't need to know about it)

Code Block
titleContents in .frm file
myFoundset

Multiple child components (array of them, notice 'elementConfig' that specifies a config value for each contained element) linked to the foundset. This type of linking is currently used by Servoy's tableviews, listviews and portals:

Code Block
"myFoundset": "foundset",
"childElements" : { "type" : "component[]", "elementConfig" : {"forFoundset": "myFoundset"} }

'Configuration' object for sending several "foundset aware" types as viewPorts (Note: the "forFoundset" usage for "dataprovider" and "tagstring" types is not yet implemented in first 8.0 public alpha):

Code Block
"myFoundset": "foundset",
"myconfiguration": "MyConfig", // or:
"myconfigurations": "MyConfig[]"
(...)
"types": {
    "MyConfig": { 
 foundsetSelector: "",      "mydataprovider" : { "type" dataproviders: [firstname:'columnOrOtherDataprovider',lastname:"someotherDataprovider"]"dataprovider", "forFoundset": "myFoundset"}
       } }"mytagstring" 

'foundsetSelector' can be:

  • "" - use parent (form's) foundset;
  • "myRelation" will give a related foundset;
  • "datasource" would give a seoarate foundset for the given datasource

'dataProviders' specifies what are the data columns mappings that need to be available in the browser - in the foundset property's 'viewPort' - in rows. These are only there if the foundset property in the spec are asking for specific dataproviders.

Runtime usage (server side Servoy JS)

...

: { "type" : "tagstring", "forFoundset": "myFoundset"}
    }
}

Runtime property access

Runtime usage: in Servoy server side JS 'foundset' typed properties are not currently available. This could change though in the near future to allow access to the real underlying foundset object (and maybe other customisations as well).