Child pages
  • Foundset property type
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

Browser value:

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

Browser side provided property content in model
myFoundset: {
    serverSize: 44, // the size of the foundset on server (so not necessarily the total record count in case of large foundsets)

    // this is the data you need to have loaded on client (just request what you need via provided loadRecordsAsync or loadExtraRecordsAsync)
    viewPort: {
        startIndex: 15,
        size: 5,
        rows: [ { _svyRowId: 'someRowIdHASH1', nameColumn: "Bubu" },
                { _svyRowId: 'someRowIdHASH2', nameColumn: "Yogy" },
                { _svyRowId: 'someRowIdHASH3', nameColumn: "Ranger" },
                { _svyRowId: 'someRowIdHASH4', nameColumn: "Watcher" },
                { _svyRowId: 'someRowIdHASH5', nameColumn: "Hatcher" } ],

        /** Request a change of viewport bounds from the server; the requested data will be loaded asynchronously in 'viewPort'
          * @param startIndex the index that you request the first record in "viewPort.rows" to have in the real foundset (so the beginning of the viewPort).
          * @param size the number of records to load in viewPort.
          */
        loadRecordsAsync: function(startIndex, size),

        /** Request more records for your viewPort; if the argument is positive more records will be loaded at the end of the 'viewPort', when negative more records will be loaded at the beginning of the 'viewPort' - asynchronously.
          * @param negativeOrPositiveCount the number of records to extend the viewPort.rows with before or after the current loaded records.
          */
        loadExtraRecordsAsync: function(negativeOrPositiveCount)
    },

    selectedRowIndexes: [16], // can be out of viewPort as well
    multiSelect: false
}

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)

Contents in .frm file
myFoundset: {
        foundsetSelector: "", 
        dataProviders: ['nameColumn']
    }
}"

'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 that need to be available in the browser - in the foundset property's 'viewPort' - in rows. For example you could have something like "dataProviders: ['nameColumn', 'age', 'imagem', 'imageurl']".

Runtime usage (server side Servoy JS)

[TODO] just make the ususal foundset obj. available in scripting

  • No labels