SilkBuilder
  • SilkBuilder
  • Development Environment
    • Development Environment
    • System Elements
    • Project, Data Model and ORM
    • Development Formats
  • Silk Builder Training
    • Sample Database
    • Plain Application
    • Easy Application
    • Simple Application
    • Complex Application
    • Report Application
    • System Environment
  • Docs
    • The ORM Structure
    • SilkBuilder
    • Silk Service
    • Java Database Class
    • Report
  • Silk Tags
    • App
    • AppHeader
    • Button
    • ButtonItem
    • Chart
    • Column
    • Content
    • DataProvider
    • DataService
    • Form
    • Group
    • Header
    • HelpBox
    • If
    • Input
    • JQcode
    • JScode
    • LogicAction
    • LogicDimension
    • LogicGrid
    • Modal
    • ModalBody
    • ModalFooter
    • Module
    • Page
    • Pagination
    • Screen
    • ScreenFooter
    • ScreenHeader
    • Tab
    • TabItem
    • Table
    • TableBody
    • TableHeader
    • TabsNav
    • Tile
  • JavaScript Objects
    • Button
    • ChartJS
    • Column
    • DataProvider
    • EventManager
    • Form
    • Input
    • Modal
    • Pagination
    • SilkPage
    • Table
    • TabsNav
    • Tile
    • Utility Functions
  • Coding Techniques
    • Data Trees
    • Pagination
    • Mark Deleted
    • Record Sync
    • Filtering Code
    • Content Template
    • Sort Data Columns
    • Form Input File
    • Button with Confirmation
    • Toggle List
    • Table Inputs
Powered by GitBook
On this page
  • Tag Definition
  • JSON String
  • DataSevice
  • Properties
  • id*
  • servicePath
  • selectName
  • autoLoad
  • loadingOrder
  • treeData
  • markDeleted
  • debugLevel
  • isPublic
  • pkColumn
  • detailDP
  • recordSync
  • dpSort
  • timeout
  • renderIf
  1. Silk Tags

DataProvider

The silk:DataProvider component extracts data from a database using a Data Outlet, which is linked to an Object Relational Mapping (ORM) file that defines the data interaction.

The DataProvider is also the repository of the information loaded from the database. Other components can access the stored data.

Operates as a standalone when connecting to an external service.

Tag Definition

Used standalone:

<silk:DataProvider
  id=""
  servicePath=""
  selectName=""
  autoLoad="true"
  loadingOrder="000"
  treeData="false"
  markDeleted="false"
  debugLevel="0"
  isPublic="false"
  pkColumn=""
  detailDP=""
  recordSync=""
  dpSort=""
  timeout=""
  renderIf=""
/>

Used as a container:

<silk:DataProvider
  id=""
  servicePath=""
  selectName=""
  autoLoad="true"
  loadingOrder="000"
  treeData="false"
  markDeleted="false"
  debugLevel="0"
  isPublic="false"
  pkColumn=""
  detailDP=""
  recordSync=""
  dpSort=""
  timeout=""
  renderIf=""
>
   Contains: optional a JSON Object array string, or a silk:DataService element.
</silk:DataProvider>

JSON String

The silk:DataProvider can also be used with pre-defined data. In this case, the DataProvider will host an array of JSON objects, which will be loaded during the initialization process. The DataProvider will not interact with the server in this scenario, so the servicePath property is unnecessary. The typical use for this scenario is to store data that is only valid in the application domain.

<silk:DataProvider id="conditionDP" pkColumn="id" >
  {"id":"0", "label":"Single", "icon":""},
  {"id":"1", "label":"Married", "icon":""},
  {"id":"2", "label":"Divorce", "icon":""}
</silk:DataProvider>

If the property pkColumn is not provided, it defaults to the name "value".

The data provided can also be received as pre-defined data in the format of "value:label" to facilitate building a simple list.

<silk:DataProvider id="conditionDP" >
  0:Single,
  1:Married
</silk:DataProvider>

This format will generate a JSON array with value and label attributes.

DataSevice

In cases when a silk:DataProvider has to access different Data Outlets based on runtime logic, the element silk:DataService provides the logic property renderIf to choose the appropriate service path and/or select name.

<silk:DataProvider id="peopleList" >
  <silk:DataService servicePath="/clients/data/peopleOutlet" selectName="allClients"
    renderIf="manager in ${silkRoleList}" />
  <silk:DataService servicePath="/clients/data/peopleOutlet" selectName="activeClients"
    renderIf="sales in ${silkRoleList}" />
</silk:DataProvider>

Properties

*Required property.

id*

Unique component identifier. Default Value: Empty.

servicePath

Sets the path to the outlet service providing access to the data. If the value is "silkVariable" it will load the flag variables as a JSON string. The selectName should indicate the variable group. If the value is silkLang" it will load the languages list as a JSON string. Default Value: Empty.

selectName

The name of the Select tag in the ORM file. Default Value: Empty.

autoLoad

If true, the component will load the data from the server after being initialized. If false, the loading method will be triggered externally. The default value is "true". Default Value: true.

loadingOrder

Defines the numeric value used to order the loading process of multiple DataProviders when the application starts. This does not affect loading programmatically triggered. Determining the loading order is essential to compensate for data dependency while displaying data. Default Value: 000.

treeData

If true, it activates the support for hierarchical information or trees nodes. This requires the fields root, parent, and level in the tags column in the ORM file. Default Value: false.

markDeleted

If true, the delete action will change to update the field. The records will be visually removed from the list. Default Value: false.

debugLevel

A numeric value indicating the level of debugging to be displayed. Default Value: 0.

isPublic

If true the data will be served from a public outlet service. This is only necessary when a private application will use a public data outlet. Default Value: false.

pkColumn

Sets the name of the columns used as the primary key when different from the DataProvider. Should be used when the DataProvider has been created using static JSON data. Default Value: Empty.

detailDP

Defines a DataProvider that will be loaded when clicking on an associated silk:Table row. Default Value: Empty.

recordSync

If true, it will load an ORM select containing extra columns for the selected record. This will trigger a second click event in the connected component after the synchronization process is completed. Default Value: Empty.

dpSort

Determines if the sorting process will run in the database. This does not work if the dataProvider property treeData is set to "true". Default Value: Empty.

timeout

Set the time, in milliseconds, for the Ajax request to timeout if it does not receive an answer. Default Value: Empty.

renderIf

PreviousContentNextDataService

Last updated 1 day ago

It contains the logic sentence defining whether the component should be rendered. The logic statement's explanation is in the documentation. Default Value: Empty.

Server Code Logic