Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 30668eb

Browse files
Merge branch 'JS-53706-DMOperatorsMVC' into 'hotfix/hotfix-v15.4.0.17'
DataOperator has been added See merge request !604
2 parents ef66286 + 444d2de commit 30668eb

File tree

8 files changed

+197
-2
lines changed

8 files changed

+197
-2
lines changed

‎aspnetmvc/DataManager/Filtering.md‎

Lines changed: 197 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
layout: post
33
title: Filtering | DataManager | ASP.NET MVC | Syncfusion
4-
description: filtering
4+
description: Description about the filtering in DataManager
55
platform: ejmvc
66
control: DataManager
77
documentation: ug
@@ -371,4 +371,199 @@ Result of the above code example is illustrated as follows.
371371
![](Filtering_images/Filtering_img11.png)
372372

373373
Result of using "or" condition
374-
{:.caption}
374+
{:.caption}
375+
376+
## Containment Operators
377+
378+
### notcontains
379+
380+
This operator is used to get the records that not contains the filter value.
381+
382+
{% highlight html %}
383+
384+
@Html.EJ().DataManager("FlatData").URL("http://mvc.syncfusion.com/Services/Northwnd.svc/Orders/").Adaptor(AdaptorType.ODataAdaptor).CrossDomain(true)
385+
386+
@(Html.EJ().Grid<MVCdoc.OrdersView>("FlatGrid")
387+
.DataManagerID("FlatData")
388+
.Query("ej.Query()
389+
.from('Orders').select('OrderID', 'CustomerID', 'EmployeeID', 'Freight', 'ShipCountry')
390+
.page(1,5).where('ShipCountry', 'notcontains', 'CAN', false)")
391+
.Columns(col =>
392+
{
393+
col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(75).Add();
394+
col.Field("CustomerID").HeaderText("Customer ID").Width(80).Add();
395+
col.Field("EmployeeID").HeaderText("Employee ID").TextAlign(TextAlign.Right).Width(75).Add();
396+
col.Field("Freight").HeaderText("Freight").TextAlign(TextAlign.Right).Width(75).Format("{0:C}").Add();
397+
col.Field("ShipCountry").HeaderText("Ship City").Width(110).Add();
398+
})
399+
)
400+
401+
402+
{% endhighlight %}
403+
404+
![](Filtering_images/Filtering_image12.png)
405+
406+
### contains
407+
408+
This operator is used to get the records that contains the filter value.
409+
410+
{% highlight html %}
411+
412+
@Html.EJ().DataManager("FlatData").URL("http://mvc.syncfusion.com/Services/Northwnd.svc/Orders/").Adaptor(AdaptorType.ODataAdaptor).CrossDomain(true)
413+
414+
@(Html.EJ().Grid<MVCdoc.OrdersView>("FlatGrid")
415+
.DataManagerID("FlatData")
416+
.Query("ej.Query()
417+
.from('Orders').select('OrderID', 'CustomerID', 'EmployeeID', 'Freight', 'ShipCountry')
418+
.page(1,5).where('ShipCountry', 'contains', 'CAN', false)")
419+
.Columns(col =>
420+
{
421+
col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(75).Add();
422+
col.Field("CustomerID").HeaderText("Customer ID").Width(80).Add();
423+
col.Field("EmployeeID").HeaderText("Employee ID").TextAlign(TextAlign.Right).Width(75).Add();
424+
col.Field("Freight").HeaderText("Freight").TextAlign(TextAlign.Right).Width(75).Format("{0:C}").Add();
425+
col.Field("ShipCountry").HeaderText("Ship City").Width(110).Add();
426+
})
427+
)
428+
429+
430+
{% endhighlight %}
431+
432+
![](Filtering_images/Filtering_image111.png)
433+
434+
### in
435+
436+
This operator used to fetch the records with value match with the given filter value.
437+
438+
{% highlight html %}
439+
440+
@Html.EJ().DataManager("FlatData").URL("http://mvc.syncfusion.com/Services/Northwnd.svc/Orders/").Adaptor(AdaptorType.ODataAdaptor).CrossDomain(true)
441+
442+
@(Html.EJ().Grid<MVCdoc.OrdersView>("FlatGrid")
443+
.DataManagerID("FlatData")
444+
.Query("ej.Query()
445+
.from('Orders').select('OrderID', 'CustomerID', 'EmployeeID', 'Freight', 'ShipCountry')
446+
.page(1,5).where('ShipCountry', 'IN', ['INDIA'], false)")
447+
.Columns(col =>
448+
{
449+
col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(75).Add();
450+
col.Field("CustomerID").HeaderText("Customer ID").Width(80).Add();
451+
col.Field("EmployeeID").HeaderText("Employee ID").TextAlign(TextAlign.Right).Width(75).Add();
452+
col.Field("Freight").HeaderText("Freight").TextAlign(TextAlign.Right).Width(75).Format("{0:C}").Add();
453+
col.Field("ShipCountry").HeaderText("Ship Country").Width(110).Add();
454+
})
455+
)
456+
457+
{% endhighlight %}
458+
459+
![](Filtering_images/Filtering_image13.png)
460+
461+
### notin
462+
463+
This operator used to fetch the records with value not match with the given filter value.
464+
465+
{% highlight html %}
466+
467+
@Html.EJ().DataManager("FlatData").URL("http://mvc.syncfusion.com/Services/Northwnd.svc/Orders/").Adaptor(AdaptorType.ODataAdaptor).CrossDomain(true)
468+
469+
@(Html.EJ().Grid<MVCdoc.OrdersView>("FlatGrid")
470+
.DataManagerID("FlatData")
471+
.Query("ej.Query()
472+
.from('Orders').select('OrderID', 'CustomerID', 'EmployeeID', 'Freight', 'ShipCountry')
473+
.page(1,5).where('ShipCountry', 'notin', ['INDIA'], false)")
474+
.Columns(col =>
475+
{
476+
col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(75).Add();
477+
col.Field("CustomerID").HeaderText("Customer ID").Width(80).Add();
478+
col.Field("EmployeeID").HeaderText("Employee ID").TextAlign(TextAlign.Right).Width(75).Add();
479+
col.Field("Freight").HeaderText("Freight").TextAlign(TextAlign.Right).Width(75).Format("{0:C}").Add();
480+
col.Field("ShipCountry").HeaderText("Ship Country").Width(110).Add();
481+
})
482+
)
483+
484+
{% endhighlight %}
485+
486+
![](Filtering_images/Filtering_image14.png)
487+
488+
![](Filtering_images/Filtering_image15.png)
489+
490+
## Lambda Operators
491+
492+
### all
493+
494+
The ALL operator returns TRUE if all the sub query values meet the condition. This operator used to fetch the records of the fields match with the given value’s fields.
495+
496+
{% highlight html %}
497+
498+
@(Html.EJ().Grid<MVCdoc.OrdersView>("FlatGrid")
499+
.Columns(col =>
500+
{
501+
col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(75).Add();
502+
col.Field("CustomerID").HeaderText("Customer ID").Width(80).Add();
503+
col.Field("EmployeeID").HeaderText("Employee ID").TextAlign(TextAlign.Right).Width(75).Add();
504+
col.Field("Freight").HeaderText("Freight").TextAlign(TextAlign.Right).Width(75).Format("{0:C}").Add();
505+
col.Field("ShipCountry").HeaderText("Ship Country").Width(110).Add();
506+
})
507+
)
508+
509+
{% endhighlight %}
510+
511+
{% highlight javascript %}
512+
513+
setTimeout(function () {
514+
var gridData = [{ OrderID: 10248, CustomerID: "VINET", EmployeeID: 5, OrderDate: new Date(8364186e5), ShipName: "Vins et alcools Chevalier", ShipCity: "Reims", ShipAddress: "59 rue de l'Abbaye", ShipRegion: null, ShipPostalCode: "51100", ShipCountry: "France", Freight: 32.38, Verified: !0 }];
515+
var data = [{ OrderID: 10248, CustomerID: "VINET", EmployeeID: 5, OrderDate: new Date(8364186e5), ShipName: "Vins et alcools Chevalier", ShipCity: "Reims", ShipAddress: "59 rue de l'Abbaye", ShipRegion: null, ShipPostalCode: "51100", ShipCountry: "France", Freight: 32.38, Verified: !0 }];
516+
var dataManager = ej.DataManager(gridData);
517+
var dataSource = ej.DataManager(data);
518+
var result = ej.Query().select("ShipCountry")
519+
var ShipCountry = dataSource.executeLocal(result);
520+
var query = ej.Query()
521+
.where("ShipCountry", "equal all", ShipCountry, false).select("OrderID", "CustomerID", "EmployeeID", "Freight", "ShipCountry");
522+
523+
var execute = dataManager.executeLocal(query); // executing query
524+
var obj = $("#FlatGrid").ejGrid("instance");
525+
obj.dataSource(execute);
526+
}, 1000);
527+
528+
{% endhighlight %}
529+
530+
![](Filtering_images/Filtering_image16.png)
531+
532+
### any
533+
534+
The ANY operator returns TRUE if any of the sub query values meet the condition. The returned data match with any one of the field in existing table.
535+
536+
{% highlight html %}
537+
538+
@(Html.EJ().Grid<MVCdoc.OrdersView>("FlatGrid")
539+
.Columns(col =>
540+
{
541+
col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(75).Add();
542+
col.Field("CustomerID").HeaderText("Customer ID").Width(80).Add();
543+
col.Field("EmployeeID").HeaderText("Employee ID").TextAlign(TextAlign.Right).Width(75).Add();
544+
col.Field("Freight").HeaderText("Freight").TextAlign(TextAlign.Right).Width(75).Format("{0:C}").Add();
545+
col.Field("ShipCountry").HeaderText("Ship Country").Width(110).Add();
546+
})
547+
)
548+
549+
{% endhighlight %}
550+
551+
{% highlight javascript %}
552+
553+
setTimeout(function () {
554+
var gridData = window.gridData;
555+
var data = [{ OrderID: 10343, CustomerID: "LEHMS", EmployeeID: 4, OrderDate: new Date(8467002e5), ShipName: "Lehmanns Marktstand", ShipCity: "Frankfurt a.M.", ShipAddress: "Magazinweg 7", ShipRegion: null, ShipPostalCode: "60528", ShipCountry: "Germany", Freight: 110.37, Verified: !0 }, { OrderID: 10344, CustomerID: "WHITC", EmployeeID: 4, OrderDate: new Date(8467866e5), ShipName: "White Clover Markets", ShipCity: "Seattle", ShipAddress: "1029 - 12th Ave. S.", ShipRegion: "WA", ShipPostalCode: "98124", ShipCountry: "USA", Freight: 23.29, Verified: !1 }];
556+
var dataManager = ej.DataManager(gridData);
557+
var dataSource = ej.DataManager(data);
558+
var result = ej.Query().select("ShipCountry")
559+
var ShipCountry = dataSource.executeLocal(result);
560+
var query = ej.Query()
561+
.where("ShipCountry", "equal any", ShipCountry, false).select("OrderID", "CustomerID", "EmployeeID", "Freight", "ShipCountry");
562+
var execute = dataManager.executeLocal(query); // executing query
563+
var obj = $("#FlatGrid").ejGrid("instance");
564+
obj.dataSource(execute);
565+
}, 1000);
566+
567+
{% endhighlight %}
568+
569+
![](Filtering_images/Filtering_image17.png)
38.3 KB
Loading[フレーム]
39.8 KB
Loading[フレーム]
3.93 KB
Loading[フレーム]
10.6 KB
Loading[フレーム]
5.74 KB
Loading[フレーム]
4.44 KB
Loading[フレーム]
21.5 KB
Loading[フレーム]

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /