kendo-labs / dlinq-helpers Goto Github PK
View Code? Open in Web Editor NEWAdd server paging, filtering and sorting via Dynamic Linq
Add server paging, filtering and sorting via Dynamic Linq
please add new property DataSourceResult class
public object Errors { get; set; }
Thanks...
Using a kendo ui grid control and ToDataSourceResult on the server side. Should DynamicLinq handle NULL string values when filtering database data. It current throws and exception.
This helper fulfills many of my needs but there is one small thing that needs to be addressed. You need to have the ability not to be case sensitive on the filters for "StartsWith", "EndsWith", and "Contains".
Since System.Linq.Dynamic
is deprecated shouldn't it be replaced with System.Linq.Dynamic.Core
in a new release for easier integration of future improvements of System.Linq.Dynamic.Core
.
I'm currently trying to filter by date but getting this error:
Operator '=' incompatible with operand types 'DateTime' and 'String'
Is there any problems with DateTime Filtering or I'm doing it wrong?
Thanks in advanced,
D.
Hi! How can i use aggregate columns with this?
Introduced with the addition of aggregates.
I'd love to be able to intercept the filter criteria and inject some level of translation into the the dlinq to support filtering from a grid using a view model to a more complex underlying domain model.
I compiled the project and run the tests but "DataContractJsonSerializerSerializesAggregates" test is not passing for reflection exception.
hi , thanks for this sharing.
how send modelstate errors to view with this library?
We're using a kendo ui angular grid with the kendo-filter-isempty-operator, which causes the dlinq helper library to blow up since isempty isn't in the dictionary
Kendo UI grid supports filtering columns based on 'NULL' or 'Not NULL' values.
These grid filters pass serialized 'Filter' objects to the server with string operators like 'isnull' and 'isnotnull' for the specified columns.
The Kendo.DynamicLinq.Filter collection of operators does not contain the 'isnull' or 'isnotnull' operators, and therefore there is an exception thrown when attempting to evaluate these filters using the ToDataSourceResult IQueryable extension method.
How can we gain support for these Kendo UI grid filters 'isnull' and 'isnotnull'?
The datatype of Filter.Value needs to be of type string instead of 'object'. The reason behind this is when we post the data from the kendo-ui grid to asp.net controller's DataSourceRequest parameter, the value field gets populated with a string[1](array of strings with length=1). Thus when executing the query into SQL it throws below error:
Operator '=' incompatible with operand types 'String' and 'String[]'
If the 'Filter.Value' is of type string, it works just as expected.
Can you add some license info (like in the kendo-ui-forms project),
hi
how to Error Handling when Create or update record (inline and incell) with kendo api?
[HttpPost]
public virtual async Task CreatePersonnels([Bind(Prefix = "models")]IEnumerable models)
{
_accountService.Value.AddPersonnels(new List(model);
await _unitOfWork.SaveAllChangesAsync();
}
var queryString = Request.Url.ParseQueryString().GetKey(0);
var request = JsonConvert.DeserializeObject(queryString);
var resultData = new List();
return Json(resultData.AsQueryable().ToDataSourceResult(request, ModelState));
}
ModelState not use with ToDataSourceResult
how to use server error in client?
thank you
How do I use if I am using generic repository pattern. If my code structure is like this and using GET Methods:
Controller:
[HttpGet]
public async Task GetAllTemplate()
{
List templates = await _emailTemplateService.GetAllTemplate();
return Ok(templates);
}
RepositoryServices for DTO:
public async Task<list> GetAllTemplate()
{
IEnumerable Templates = await _unitWork.TemplateRepositoryUnit.GetAllTemplate();
List TemplateDtos = new List();
foreach (Template Template in templates)
{
templateDtos.Add(new TemplateDto
{
EtId = template.EtId.ToString(),
TemplateName template.EtName,
});
}
return templateDtos;
}
Repository:
public async Task<ienumerable> GetAllTemplate()
{
return await FindByCondition(et => et.EtIsDeleted != true).ToListAsync();
}
Should I need to create "ToDataSourceResult" extension method or this will be also come with nuget package of dot net core, In my implementation it is showing some problems related to ToDataSourceResult.
And should I use this with GET method as well, because I am getting all data through the and showing on grid with angular.
I haven't found any related library about this compatible for .net core, so I want to rewrite it to .net core version, Can I do this?
When the doesnotcontain operator is used, ToExpression
is currently just using !{field}.{comparison}(@{index})
. This leaves out rows where the field value is null or empty, though. Checking the field for null or empty should produce a more accurate query and result. I'd be happy to submit a quick PR if you agree.
Parameters are NOT bound either when using DataSourceRequest object, or following parameters:
int take, int skip, IEnumerable sort, Kendo.DynamicLinq.Filter filter, IEnumerable aggregates
When I call ToDataSourceResult with and integer filter it works fine; however, when trying to call ToDataSourceResult with a filter of a decimal or double, I am getting this error:
An exception of type 'System.Linq.Dynamic.ParseException' occurred in System.Linq.Dynamic.dll but was not handled in user code.
"Operator '=' incompatible with operand types 'Decimal?' and 'Double'".
Have you seen this? Any thoughts?
Considering the Kendo UI DataSource supports serverGrouping, it would be beneficial if the dynamic GroupBy extension method could be used with the incoming group parameter to perform the appropriate grouping.
Compiled with VS 2013 is just fine but the latest C# is throwing.
See my Stackoverflow question and how I solved it.
Let me know if you have the same issue and if you are interested in a PR.
Users are able to include a "Does not contain" filter but the current Filter class does not have a mapping to Dynamic Linq for "doesnotcontain". I can submit a quick PR if you agree it's worth adding.
If the request doen't have an ordering, the entity framework returns an error to do the paging, so it could be better to set the default ordering to the Primary key of the entity if it doesn't have any order.
just like this, but getting the correct field using reflection
if (request.Sort == null || request.Sort.Count() == 0)
{
var sort = new List<Sort>();
sort.Add(new Sort() { Dir = "asc", Field = "Id" });
request.Sort = sort;
}
If one field of the grid is an enum, if you filter you get an error,
I added this code to change the enums to their correct values, i could be done inside the library
private static void UpdateFilter(Filter filter)
{
if(filter==null)
{
return;
}
if (filter.Field != null)
{
var campo = filter.Field.Split('.');
var val = filter.Value;
var type = typeof(T);
foreach (var c in campo)
{
type = type.GetProperty(c).PropertyType;
}
if (type.IsEnum)
{
val = val ?? "0";
try
{
var enumVal = Enum.Parse(type, val.ToString());
filter.Value = enumVal;
}
catch { }
}
}
if(filter.Filters ==null)
{
return;
}
foreach (var item in filter.Filters)
{
UpdateFilter<T>(item);
}
}
The ASP.NET MVC version of this DataSourceRequest library has a stand-alone javascript client that produces a DataSource payload. Does this dynamic linq library also offer a stand-alone client, or is it intended only to work with the kendo grid control?
The Filter.Collect method should be modified as follows:
` private void Collect(List filters)
{
if (Filters != null && Filters.Any())
{
foreach (Filter filter in Filters)
{
filters.Add(filter);
if (filter.Filters?.Count > 0) // add this line
{ // add this line
filter.Collect(filters);
} // add this line
}
}
else
{
filters.Add(this);
}
}`
The Kendo.Mvc.Extensions ToDataSourceResult has an overload that enables a function to be called in order to bind the result to VM/DTO this overload is missing in Kendo.DynamicLinq where only 3 overloads exist.
I tried to use the Kendo.Mvc.Extensions but the filters and sorts don't match up.
Using the Kendo.Mvc.Extensions made a huge improvement in performance as the DTO conversion was made after the data was filtered and sorted.
It will be great to have it.
10x
I don't think the filter is being applied. From the results of ToDataSourceResult I can tell that the Take, Skip, and Sort are working as expected, but the Filter is not.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.