@progress/kendo-data-query with group and null value

1 Answer 367 Views
Data Query Grid
Carlos
Top achievements
Rank 2
Iron
Iron
Iron
Carlos asked on 31 May 2021, 01:29 PM

Hello,

I found a bug when process a group with null value.

This is the example that doesnt work: https://stackblitz.com/edit/react-hmnv9d?file=app%2Fmain.jsx

The first group with field 'estadoDenominacion' value 'null' is not rendering.

The response string in the products-loader.jsx is an example of our .NET Core API, our backend is something like this:

using Kendo.Mvc;
using Kendo.Mvc.Extensions;
using Kendo.Mvc.UI;

public DataSourceResult Get([DataSourceRequest] DataSourceRequest requestl) 
{
    return Repository.Get().ToDataSourceResult(request);
}

The Kendo.MVC library we are using are: Telerik.UI.for.AspNet.Core 2021.2.511

I found the method: translateDataSourceResultGroups use the key field of the response to build a group object but if the field is null or undefined, then use undefined as value, and in this case, the value of the first group must be null.

here do yoyu have a snippet of your library:

// utils.js
var isPresent = function (value) { return value !== null && value !== undefined; };

// deserialization.js
var valueOrDefault = function (value, defaultValue) { return isPresent(value) ? value : defaultValue; };
var normalizeGroup = function (group) { return ({
    aggregates: group.Aggregates || group.aggregates,
    field: group.Member || group.member || group.field,
    hasSubgroups: group.HasSubgroups || group.hasSubgroups || false,
    items: group.Items || group.items,
    value: valueOrDefault(group.Key, valueOrDefault(group.key, group.value))
}); };

The value is returning undefined because group.value is undefined (doesnt exist in the response).

Thanks!

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 01 Jun 2021, 07:16 AM

Hello, Carlos,

Thank you for reporting this.

I can confirm that this is an issue with the current version of the Kendo data query package.

I have logged this for fixing, and the status can be monitored here:

https://github.com/telerik/kendo-react/issues/954

Currently, the workaround will be to loop over the processed data and replace undefined with null after processing, or to replace with empty string instead of null in the initial data.

Additionally, I have added some Telerik points to your account for bringing this to our attention.

Apologies for the inconvenience this may have caused you.

Regards,
Stefan
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Carlos
Top achievements
Rank 2
Iron
Iron
Iron
commented on 07 Jul 2021, 09:31 AM

Hello,

I have seen that a new version of kendo react (4.7.0) has been released but this bug has not been corrected nor has a new version of the kendo-data-query package been released.
I just wanted to remember it, since I am still waiting to be able to work with this package.

Thanks!
Stefan
Telerik team
commented on 07 Jul 2021, 10:47 AM

Hello, Carlos,

The issues are fixed in an order based on different factors.

After we prioritize it, we will change its status.

Then when it will be released we will set the milestone to reflex the version:



Until this is resolved, I applied the suggested workaround to the example to allow continue working on this without a major blocker:

https://stackblitz.com/edit/react-hmnv9d-vbzsmw?file=app%2Fproducts-loader.jsx

Tags
Data Query Grid
Asked by
Carlos
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Stefan
Telerik team
Share this question
or