Incorrect OData OrderBy clause is generated for navigational property

Imagine that we have a class named Contract, with a navigation property named Vendor, of type Vendor.
The Vendor class has a property named Name of type string.
I have an OData endpoint, that feeds the data grid with contract records. In the grid I also show the vendor's name in a column.
Now, when I sort based on the contract's primary fields, like number, start, end, all is good. But when I sort based on the vendor's name, the LoadDataArgs.OrderBy has a value of np(Vendor.name).
Now when the request is executed I see that the back end generated the error:
"The query specified in the URI is not valid. The child type 'Vendor.Name' in a cast was not an entity type. Casts can only be performed on entity types."
But if I change manually the request Uri in Postman to "vendor/Name" from "np(Vendor/Name)" is working fine. Am I missing something?

Thank you, George

P.S.: I tried filtering on the same column and the filter clause is (np(Vendor.Name)) = 'test' which generates the same error as before.

Check this demo for reference on how to setup the DataGrid for OData:

The key is AsODataEnumerable() extension method - this is how you tell the DataGrid to use OData filter and sort expressions.

I am using AsOfDataEnumerable when I get the response back, as is in the example and yes I consulted the example when I was implementing my solution.
The example on the mentioned URL, is no using navigational properties, and as I wrote, if I apply filter or sorting on none navigation properties on my grid, then it works fine.
But when I apply filter or sorting on navigational properties, the value that is generated is matching what dynamic LINQ would expect. np(Vendor.Name) is for null propagation.
In your example if you had a navigational property, you would see that the function of getting customers would fail when executing the call "return await response.ReadAsync<ODataServiceResult>();". The call to the AsODataEnumerable, is executed after the request and response cycle. Am I wrong?

Thank you for your response.

Thanks again for your response. Although your example is different than the one I was looking for, I was able to find the issue combining both of your comments.
The grid is bind to an IEnumerable collection and it had a default filter, which was applied before the call to the load data function, which returns the dataset as an ODataEnumerable. So the grid was assuming that it was creating LINQ filters and not OData. After applying the initial filter with your second example and not as a filter on the grid it worked fine. I hope you understand what I am trying to say.

Thanks again.

I understand perfectly what you are saying and I will repeat my previous suggestion.

You should use this extension method even for initial binding to empty IEnumerable.

Yeap, you are correct. The initial binding and the grid filter were set on an empty IEnumerable before the AsODataEnumerable was applied. So now it works, Thanks a lot.