Description
A DataSource has a rather self-explanatory name; however, a
DataSource driver in context to the DataGrid can become a very essential
key to your software. A DataSource driver will interact with your data
source directly, such as a DB_DataObject or a MDB2 query and handle
all of the paging and sorting code for you, resulting in very few lines
of code that you will need to write.
How to use the drivers
There are two methods intended to be used for binding a DataSource driver:
bind()
and bindDataSource().
The bind() method is able to autodetect the right driver
in many cases. For example, you can pass DB_Table
or DB_DataObject
instances to it. Strings can't be autodetected because they could contain
CSV or XML data, for example. In such cases, you can specify the type as
the third parameter in the bind() method call (e.g.
'CSV' or 'XML').
If you are building your own custom DataSource driver, using
bindDataSource() is the method of choice. Just
instantiate your DataSource class and pass this instance to the
bindDataSource() method.