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

DataSource change event contains no results. AJAX works fine.

1 Answer 152 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Philip
Top achievements
Rank 1
Philip asked on 01 Mar 2012, 01:16 AM
KendoUI Team:
1. Nice start to a cool framework.
2. I am having significant issues with the Datasource wrapper, hitting a JSON WCF RIA services factory. Essentially, the change function gets called, but the event arguments do not contain the results.
3. When I hit the same service with a .ajax(Params) call, the results are all there (1 record)

eg: - this works fine. data.xxx.RootResults is fully populated as expected.
 function Load() {
        var Params = {};
        Params.type = 'GET';
        Params.url = 'EPSolutions-Empower-Wcf-DomainServices-RIAService-EmpowerService.svc/' + 'JSON/' + 'GetAccountSummaryDTOByAccountNumber';
        Params.dataType = 'json';
        Params.data = 'accountNumber=' + $("#uiAccountNumberInput").val();
 
        Params.success = function (data) {
 
            var returnedEntity;
            for (var i in data.GetAccountSummaryDTOByAccountNumberResult.RootResults) {
                returnedEntity = data.GetAccountSummaryDTOByAccountNumberResult.RootResults[i];
  
 
            }
        };
 
        $.ajax(Params);
    }


eg: the change: Function (e) has no data object as a member, unlike the above ajax call.
// AccountSummaryDTO
    var accountSummaryDTO = new kendo.data.DataSource({
        transport: {
            read: {
                type: "GET",
                url: "EPSolutions-Empower-Wcf-DomainServices-RIAService-EmpowerService.svc/JSON/GetAccountInfoDTOByAccountNumber",
                dataType: "json",
                data: {
                    accountNumber: function () {
                        return $("#uiAccountNumberInput").val();
                    }
                }
            }
        },
  
        change: function (e) {
            var returnedEntity;
 
            var dd = this.at(0);
 
         //   for (var i in e.GetAccountSummaryDTOByAccountNumberResult.RootResults) {
         //       returnedEntity = e.GetAccountSummaryDTOByAccountNumberResult.RootResults[i];
//
//            }
 
        
        },
 
        error: function (e) {
            alert(kendo.format("ERROR: Unable to read account {0}", $("#uiAccountNumber").val()));
        }
    });

In both cases, the Network traffic shows the correct response, ie exactly the same for each example. 
{"GetAccountSummaryDTOByAccountNumberResult":{"TotalCount":1,"RootResults":[{"AccountBalance":-51.70,"AccountBalanceState":2,"AccountBalanceStateText":null,
etc (very wide)

No idea why the change event does not have the data in it.
schema ?

Your help appreciated.
Phil Harris
epSolutions

1 Answer, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 01 Mar 2012, 09:59 AM
Hello Philip,

Unlike jQuery ajax, our DataSource's change event does not have arguments. In order to get the data you will need to use either data or view methods.

Regards,
Rosen
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
Philip
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Share this question
or