This is a migrated thread and some comments may be shown as answers.

Get dataSource data without using template

1 Answer 101 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 05 Apr 2012, 04:59 PM
I'm attempting to get the data from a DataSource and loading that data into an array to send to a PHP page to export to XLSX.

I've pored over the documentation, and all I see are references to use view() as part of loading data into a Kendo widget.

How can I just read the contents of the data so I can pick out the fields I need?

A "Walkthrough" section for DataSource might help.

1 Answer, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 09 Apr 2012, 08:35 AM
Hi,

 That view() method is what you need. It will return the data read by the data source. You need to call it after the "change" event of the data source has been raised. Here is a quick example:

var dataSource = new kendo.data.DataSource( {
       transport: {
             read: {
                  url: "/data.php"
             }
       },
       change: function() {
             var data = this.view();
             // use the data
       }
});
 
// read the data
dataSource.read();

All the best,
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Data Source
Asked by
Mike
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or