We have the overview of the backbase databinding in previous post, now we will go the further detail on it.

It provides the data widgets like listGrid/treeGrid to display the underlying data in tabular form.

The Table/ListGrid that user faces is called Data Observer, which gives you the ability to define how bound data (bound with the dataSource) is displayed in the application. Essentially, the dataObserver is a way to customize the presentation of data from a dataSource.

The listGrid and treeGrid BTL elements are both standard dataObserver.
A dataSchema is in the middle of DataObserver and DataSource, which defines how the dataSource is mapped to the output. It allows you to easily update your queries in the case that the underlying field structure changes.

The DataFormatter can be used to do customization for displaying different formatting on the data in order for user to see different view of the original data, such as add a ‘$’ sign in front of a digit to represent the data in a form of American Dollar.

A listGrid widget is a powerful mechanism for displaying data, and at the most of the time we will use this widget to represent the underlying xml data. Consisting of a listGrid container widget and child listGridCol elements, the listGrid displays rows of data from a local or remote source. The data source can contain either static data or dynamically generated data, and both sorting and editing functionality is built into the widget. Furthermore, you can choose which columns to display, column resizing, column styling. For navigation, you can either connect a BTL pager widget to the listGrid or create your own paging/navigation mechanism.

Following is a code snippet which shows how to create a listGrid to display structured data:

<b:dataSource xmlns:b=" " xmlns:e=" " name="data” e:behavior="b:localData">
<b:dataContainer>
<records>
<record>
<name>Frank</name>
<surname>Remote</surname>
<email>frank.showcase@mail.company.com</email>
</record>
<record>
<name>Anne</name>
<surname>RemoteShowmodel</surname>
<email>anne.showmodel@mail.company.com</email>
</record>
</records>
</b:dataContainer>
</b:dataSource>
<b:listGrid dataSource="data" readonly="true">
<b:listGridCol label="Email" select="*[3]“/>
<b:listGridCol label=”Name” select=”name”/>
<b:listGridCol label=”Surname” select=”surname”/>
</b:listGrid>

Following picture is the view of the code:

As seen from above, a listGrid element represents a table to show the data, under which each column is specified by a listGridCol element. There is a ‘dataSource’ attribute of listGrid to have a reference to a dataSource. And there is a ‘e:behavior’ attribute of dataSource to specify it’s local data or remote data.

 

 

Local Data Detail

Local Data is provided as a backbase BTL behavior that can be added to a data source as attribute. After Local Data behavior is added to a specified data source,that data source element is able to have following attributes, properties, methods and events.

Local Data will not relate to XML HTTP request object. After data source is downloaded to client,it will be persisted as client side object in memory. Each CRUD operation is done on client side.

 

Attribute

Description

asynchronous

Immediately returns on a request without waiting for the results.

dataSelect

XPath expression (with Backbase extensions, see bb.evaluateSmart) to select records on which to operate. The default value points to the dataContainer child node inside the control.

dataType

Determines the language in which the dataSource is stored.

 

Method

Description

pushData

Sends the data to a server. The data is the client data source after CRUD operations by user.

sendRequest

Sends request to the client, note this is different from Remote data because it just call client function to do CRUD operations and do not

Relate to XML HTTP request object.

 

 

Remote Data Detail

As we can see from above description, the remote data is preferred if the data set of source is huge. So we will research more detail about the remote data here.

Remote Data is provided as a backbase BTL behavior that can be added to a data source as attribute. After Remote Data behavior is added to a specified data source,that data source element is able to have following attributes, properties, methods and events.

Attribute

Description

asynchronous

A request to a server is performed asynchronously.

cacheLimit

The maximum number of records, usually rows in a (list) grid, that are kept in a cache by the dataSource. A high number can increase performance if large amounts of data are kept, though at the cost of memory usage.

dataSelect

The XPath expression to select records on which to operate. By default, it is empty, and is only applicable to XML.

dataType

Determines the data type in which the dataSource is stored.

method

HTTP method used to open the connection.

requestType

Determines the data type in which the request is sent to a server.

url

Points to the URL where the data is stored.

useTimestamp

Determines if a timestamp is used in the URL to prevent caching of requests.

Property

Description

password

Specifies the password for authentication. It is empty by default.

url

Points to the URL where the data is stored. It is used for sending a request and can be modified for every request.

urlQuery

A set of key-value pairs to pass to a server in the URL.

user

Specifies the name of the user for authentication. It is empty by default.

Method

Description

cancelRequest

Cancels a request.

sendRequest

Sends request to the server in order to do CRUD operations to the underlying data. This is different from local data because it will use XML HTTP request object to send Ajax request to server side url.

Event

Description

dataRequest

Fires when data is requested.

dataResponse

Fires when data is received.

We will discuss the detail on the client server communication via remoteData to support the CRUD operations on data in next part.

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5 out of 5)
Loading ... Loading ...

You may also like following posts