3 Answers, 1 is accepted
Hello Jeff,
I am not sure I understand entirely the scenario. One way I can think of is by providing a dataSource.schema.parse function that would remove empty values.
If the above does not help please provide a runnable example where empty lines are returned, so I can suggest a possible approach.
Regards,
Aleksandar
Progress Telerik
Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive, special prizes, and more, for FREE?! Register now for DevReach 2.0(20).
What I ended up doing was filtering those blank lines in the server side linq statement when getting the data with....
&& !string.IsNullOrWhiteSpace(x.Vendor))
Follow?
Hello Jeff,
Thank you for the additional details. Indeed in this scenario, you can follow the suggestion from my previous post and configure the schema.parse function.
I created a sample to demonstrate the approach. A call to a mock API would return the following JSON, where the second object has an empty value:
[{"ProductName":"One"},{"ProductName":""},{"ProductName":"Three"}]
In this scenario you can update the function as:
schema:{
parse:function(response){
var products = [];
for (var i = 0; i < response.length; i++) {
if(response[i].ProductName !=""){
var product = {
ProductName: response[i].ProductName
};
products.push(product);
}
}
return products;
}
}
Here is the runnable example for you to review. I hope this helps.
Regards,
Aleksandar
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.