@using Newtonsoft.Json;
@Html.EJS().QueryBuilder("querybuilder").Width("100%").Columns(col =>
{
col.Field("OrderID").Label("Order ID").Add();
//..
}).DataSource(dataManager => { dataManager.Url("https://js.syncfusion.com/demos/ejServices/Wcf/Northwind.svc/Orders").CrossDomain(true).Adaptor("ODataAdaptor"); }).MaxGroupCount(5).ConditionChanged("updateRule").FieldChanged("updateRule").ValueChanged("updateRule").OperatorChanged("updateRule").RuleDelete("updateRule").GroupDelete("updateRule").RuleInsert("updateRule").GroupInsert("updateRule").Render()
@(Html.EJS().Grid("grid").DataSource(dataManager => { dataManager.Url("https://js.syncfusion.com/demos/ejServices/Wcf/Northwind.svc/Orders").CrossDomain(true).Adaptor("ODataAdaptor"); }).Width("auto").RowHeight(60).Columns(col =>
{
col.Field("OrderID").HeaderText("Order ID").Width("120").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Add();
//..
}).Render())
<script>
function updateRule() {
var dataManagerQuery, qryBldrObj = ej.base.getComponent(document.getElementById("querybuilder"), 'query-builder'), predicate = qryBldrObj.getPredicate(qryBldrObj.rule),
grid = ej.base.getComponent(document.getElementById("grid"), 'grid');
if (ej.base.isNullOrUndefined(predicate)) {
dataManagerQuery = new ej.data.Query().select(['OrderID', 'CustomerID', 'EmployeeID', 'Freight', 'ShipCountry']);
} else {
dataManagerQuery = new ej.data.Query().select(['OrderID', 'CustomerID', 'EmployeeID', 'Freight', 'ShipCountry']).where(predicate);
}
grid.query = dataManagerQuery;
grid.refresh();
}
</script> |