var dm = ej.DataManager({ url: "http://localhost:65055/odata/ArticleApi", adaptor: new ej.ODataV4Adaptor() });But now I want tot use the query of the datamanager as a datasource for the grid to narrow the selection and expand some objects. How can I do this? The examples show how to do it in the done event of the executeQuery command, but I want it the other way around to keep the benefits of using the grid with a datasources.
$("#Grid").ejGrid({
dataSource: dm
});
<div id="FlatGrid"> </div>
<script type="text/javascript"> var dm = ej.DataManager({ url: "/odata/Orders", adaptor: new ej.ODataV4Adaptor() }); var query = ej.Query().where("EmployeeID", ej.FilterOperators.equal, 2, false); $("#FlatGrid").ejGrid({ dataSource: dm, query : query, allowPaging: true, columns: [ { field: "OrderID", headerText: "Order ID", isPrimaryKey: true }, { field: "CustomerID", headerText: "Customer ID" }, { field: "EmployeeID", headerText: "Employee ID" }, { field: "ShipCountry", headerText: "Ship Country" }, { field: "ShipCity", headerText: "Ship City" } ] });
|
<div id="FlatGrid"> </div>
<script type="text/javascript"> var dm = ej.DataManager({ url: "/odata/Orders", adaptor: new ej.ODataV4Adaptor() }); var query = ej.Query().where("EmployeeID", ej.FilterOperators.equal, 2, false); $("#FlatGrid").ejGrid({ dataSource: dm, query : query, allowPaging: true, columns: [ { field: "OrderID", headerText: "Order ID", isPrimaryKey: true }, { field: "CustomerID", headerText: "Customer ID" }, { field: "EmployeeID", headerText: "Employee ID" }, { field: "ShipCountry", headerText: "Ship Country" }, { field: "ShipCity", headerText: "Ship City" } ] });
|