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

Second attempt at read of data source not working

1 Answer 86 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Lisa
Top achievements
Rank 1
Lisa asked on 03 Oct 2013, 07:55 PM
Hi - I have a Data Source defined for some fields on our webpage.  The first time in, it reads the data just fine.  Our users can select another value from a filter on the page, and when they click the an apply button, it should refresh the data, but it doesn't seem to do the read.  I'm not getting any errors, it just isn't doing the second read.

Any ideas?

kdsStudentInformation = new kendo.data.DataSource({
            transport: {  //transport: defines the URL endpoints for remote data (read/insert/update/delete)
                read: function (options) {
                    $.getJSON(Helpers.toServicesUrl("/GetctrlEWSStudentInfoPanel"),
                        {
                            studentId: studentIDParm,  //935824
                            username: WSIPCContext.UserName,
                            schoolCode: schoolCodeParm,
                            schoolYear: schoolYearParm,
                            districtId: WSIPCContext.DistrictId
 
                         },
                         function (data) {
                            stuInfox = data.GetctrlEWSStudentInfoPanelResult.RootResults;
                            kdsStudentInformation.data(stuInfox);
                            loadStudent();
 
                        }).fail(function (jqXHR) {
                            options.error(jqXHR);
                        });
                    //read               
                }, //transport
                schema: { //tells the Data Source where to find the result set
                    data: "stuInfox"
                }
           });

And to read it:

kdsStudentInformation.read();

thanks!

1 Answer, 1 is accepted

Sort by
0
Lisa
Top achievements
Rank 1
answered on 03 Oct 2013, 10:11 PM
Interesting.  I modified my data Source code to look like this, and it looks like it's working:

//DataSource for Student Information
kdsStudentInformation = new kendo.data.DataSource({
    transport: {
        read: function (options) {
            if (!(kdsStudentInformation)) {
                options.success([]);
                return;
            }
            $.getJSON(Helpers.toServicesUrl("/GetctrlEWSStudentInfoPanel"),
            {
                studentId: studentIDParm,  //935824
                username: WSIPCContext.UserName,
                schoolCode: schoolCodeParm,
                schoolYear: schoolYearParm,
                districtId: WSIPCContext.DistrictId
 
            }).success(function (data) {
                options.success([]);
                stuInfox = data.GetctrlEWSStudentInfoPanelResult.RootResults;
                loadStudent();
 
            });
        }
    }
});
Tags
Data Source
Asked by
Lisa
Top achievements
Rank 1
Answers by
Lisa
Top achievements
Rank 1
Share this question
or