Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aggregates #12

Closed
boisellea opened this issue Jan 31, 2020 · 8 comments
Closed

Aggregates #12

boisellea opened this issue Jan 31, 2020 · 8 comments

Comments

@boisellea
Copy link

Hi, I already commented your last version on previous closed topic.

Aggregates is not working on my side :

Using Kendo.DynamicLinqCore.2.2.2 and Kendo UI v2019.3.1023.

var dataSource = new kendo.data.DataSource({
transport: {
read: {
url: "https://xxx.com/Service.svc/GetCmds",
type: "POST",
dataType: "json",
contentType: "application/json"
},
parameterMap: function (data, type) {
if (type == "read") {
return JSON.stringify(data);
}
}
},
schema: {
model: {
fields: {
id_cmd: { type: "number" }
}
},
data: "Data",
total: "Total",
aggregates: "Aggregates"
},
serverPaging: true,
serverSorting: true,
serverFiltering: true,
serverAggregates: true,
pageSize: 25,
aggregate: [{ field: "id_cmd", aggregate: "count" }]
});

The request sent is :
{"take":25,"skip":0,"page":1,"pageSize":25,"aggregate":[{"field":"id_cmd","aggregate":"count"}]}

My webservice returns nothing, no error but nothing is returned at all.

Definition into the webservice :
Function GetCmds(ByVal skip As Integer, ByVal take As Integer, ByVal sort As IEnumerable(Of Sort), ByVal filter As Filter, ByVal aggregate As IEnumerable(Of Aggregator), ByVal groups As IEnumerable(Of Group)) As DataSourceResult

Thank you.

@linmasaki
Copy link
Owner

linmasaki commented Feb 1, 2020

Yes, I saw your issue recently. I would check it and give you some samples for you ASAP after complete my private job. :)

@linmasaki
Copy link
Owner

linmasaki commented Feb 12, 2020

@boisellea Try the version package(v3.1.0). I think the missing aggregator parameter caused this problem, and I also add NUnit test cases for you to check!

@boisellea
Copy link
Author

Hi CoCo,

Thanks for that, however I still have the same problem/behavior : nothing is return from wcf webservice.

The aggregates part of https://github.com/mshtawythug/dlinq-helpers works on my side, I don't know if it can be helpful for you.

@linmasaki
Copy link
Owner

linmasaki commented Feb 12, 2020

WOW, It is confused to me. Could you see my test sample to compare yours? Is there have any difference between the request data? Or any error messages? TKS~

@boisellea
Copy link
Author

boisellea commented Feb 12, 2020 via email

@boisellea
Copy link
Author

Hi,

I found the error :

According to Telerik here : https://docs.telerik.com/kendo-ui/api/javascript/data/datasource/configuration/schema

_The aggregate results should have the following format:

{
  unitPrice: {
      max: 100,
      min: 1
  },
  productName: {
      count: 42
  }
}_

In my case, .ToDataSourceResult(JsonConvert.DeserializeObject(Of DataSourceRequest)("{""take"":10,""skip"":0,""aggregate"":[{""field"":""id_cmd"",""aggregate"":""sum""}]}")).Aggregates.ToString returns :

"{ id_cmd = { sum = 108776131 } }"

instead of :

"{ id_cmd : { sum : 108776131 } }"

@linmasaki
Copy link
Owner

linmasaki commented Mar 4, 2020

Sorry, because I'm not very familiar with VB.net, I'm still trying to find possible points for the problem.

In my case, ToDataSourceResult returned format is "{ id_cmd : { sum : 108776131 } }":confused:, could you give me a web console shot to display the whole result value to me? thanks!

@linmasaki
Copy link
Owner

Since there has been no reply for a long time, so this issue is closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants