Hi,
There is a bug on the kendo grid when you have inline editing and a filter applied
So what's happening is that when you apply a filter and then click on "add new record" it doesn't show the new record, even worst it actually add the new empty record in the datasource, so you see new empty line when you remove the filter ....
it's really easy to demonstrate, i make you a dojo : https://dojo.telerik.com/EJIhohuf
this dojo is actually the editing inline demo (https://demos.telerik.com/kendo-ui/grid/editing-inline) with just the filtering enabled like so :
filterable: {
mode: "row"
}
to reproduce :
- apply any kind of filtering
- try to add a new record
- here you see nothing is happening, we expect to see a new empty line to add a new record (also the beforeEdit event is not fired but not sure this is a bug)
- remove the filtering
- you can see the empty lines (if click 5 times on add new record you get 5 empty lines)
Best regards,
you have a great product hope you can improve it even more
Hello, Mathieu,
Thank you for your feedback and suggestion to add a warning in Kendo UI documentation. I will communicate with my managers.
Meantime, I have come across another solution that you could be interested to check.
As you could see in the dojo example you could use the dataBinding event handler of the Grid and check whether the dataSource has a filter and the action type is "add". If the new items have empty properties - remove them:
dataBinding: function(e) {
var grid = $("#grid").data("kendoGrid");
var ds = grid.dataSource;
var filter = ds.filter();
if (filter && e.action === "add") {
var items = e.items;
$.each(items, function(index, value) {
var isEmpty = Object.values(value).some(x => (x === null || x === ''));
if (isEmpty) {
ds.remove(value);
}
});
e.preventDefault();
}
}
Regards, Silviya Stoyanova Progress Telerik
Hi,
Thank you for the clarification, I understand now.
I still thinks it's partly buggy because normally when we click multiple times on add new record it doesn't add multiple record.
So i think this could be improve.
Also Thank you very much for your answer and the link. I think you should add that to the documentation as a warning. for filtering to explain that it's also applied to new record and so we could need your link or to new record to explain that in the case of filtering we culd need that link too)
Hello Mathieu,
Thank you for helping us to improve our product.
In the provided example when a filter is applied the expected behavior is the items that meet the filter criteria to be shown. For instance, if the Unit Price is filtered to display items not equal to 18 then you can notice that a new row for a new record is available, but If the criteria are set to equal then there is no available new row because the rule is not met.
To apply the specific filter behavior you are looking for I would suggest referring to the following article:
https://docs.telerik.com/kendo-ui/knowledge-base/use-filtering-with-dynamic-default-values
If you think that the behavior could be added as a valuable addition out-of-the-box I could convert this thread to a feature request.
I am looking forward to your answer.
Regards, Silviya Stoyanova Progress Telerik