How To Access All DataSource Data

Posted by jts-law on 26-Apr-2017 15:04

I have a blank page with a  datasource that contains multiple tables.  One of the tables is bound to a grid.  Another table contains rules that define how to present the data to the user.  For example, for certain rows the user can't update some fields and for other rows the user can update everything.  I need to access the rules to determine which fields to display/hide on the popup edit form.  I'm also going to use the information in the rules table to turn on/off the Edit, Delete, and Add new record buttons.

From within a "dataBound" event on the grid I can see the different tables defined within the that.scope._$ds object, but the only table that shows any data records is the table bound to the grid, the other tables data is empty.

Does the datasource not store any data that is returned from the service but is not bound to anything on the page?

Thanks in advance.

Louis

Posted by jts-law on 26-Apr-2017 15:47

Of course, as soon as I post this I find the solution.  In case anybody else needs something like this, the following is what I found:

The _$ds object has all tables objects within it (Table1, Table2, Table3, etc).  The only table object that appears to have any data in it though is the table that is bound to the grid (Table1 in my example).  But, Table1.transport.jsdo all 3 of the temp tables (ttTable1, ttTable2, etc).

The other tables data within the returned dataset can be accessed using _$ds.Table1.transport.jsdo.ttTable2._data or _$ds.Table1.transport.jsdo.ttTable3._data.

Posted by egarcia on 26-Apr-2017 16:40

Hello Louis,

Here is some additional information that can help you.

Do you have a relationship between the multiple tables or are them top level tables?

The Kendo UI DataSource is associated to only one table. When working with a resource / dataset with multiple tables, the code internally uses the tableRef property at the transport level to specify the table.

The data source that you found to have data is because a read operation was performed.

The read operation in the DataSource calls the read method in the transport which then calls fill() in the JSDO to perform the READ operation. The READ operation can return data for all the tables. You can access the data using getData() in the JSDO ( datasource.transport.jsdo.ttTable.getData() ).

Please let me know if you need more information.

I hope this helps,

Edsel

All Replies

Posted by jts-law on 26-Apr-2017 15:47

Of course, as soon as I post this I find the solution.  In case anybody else needs something like this, the following is what I found:

The _$ds object has all tables objects within it (Table1, Table2, Table3, etc).  The only table object that appears to have any data in it though is the table that is bound to the grid (Table1 in my example).  But, Table1.transport.jsdo all 3 of the temp tables (ttTable1, ttTable2, etc).

The other tables data within the returned dataset can be accessed using _$ds.Table1.transport.jsdo.ttTable2._data or _$ds.Table1.transport.jsdo.ttTable3._data.

Posted by egarcia on 26-Apr-2017 16:40

Hello Louis,

Here is some additional information that can help you.

Do you have a relationship between the multiple tables or are them top level tables?

The Kendo UI DataSource is associated to only one table. When working with a resource / dataset with multiple tables, the code internally uses the tableRef property at the transport level to specify the table.

The data source that you found to have data is because a read operation was performed.

The read operation in the DataSource calls the read method in the transport which then calls fill() in the JSDO to perform the READ operation. The READ operation can return data for all the tables. You can access the data using getData() in the JSDO ( datasource.transport.jsdo.ttTable.getData() ).

Please let me know if you need more information.

I hope this helps,

Edsel

This thread is closed