BoldSignA modern eSignature application with affordable pricing. Sign up today for unlimited document usage!
var
dm = ej.DataManager("http://mvc.syncfusion.com/Services/Northwnd.svc/");
var
query = ej.Query()
.from("Orders")
.select("OrderID","CustomerID","OrderDate","Employee.FirstName")
.page(1,
10)
.expand("Employee");
var
promise = dm.executeQuery(query);
promise.done(function
(e) {
$('#Grid').ejGrid({dataSource: e.result});
}
But how does this bind to the remote source? If I now have a user that performs a search on this grid, I will have to create a new Query again, instead of using the built in functionality of the Grid, correct?
I was hoping something like this is possible, where the Grid still builds the OData URI.
var dm = ej.DataManager("http://mvc.syncfusion.com/Services/Northwnd.svc/");
$('#Grid').ejGrid({dataSource: dm, from:"Orders"});
If this is not possible, it's not an issue. It would just seem a cleaner approach to me.
Hi Sebastian
We have analyzed the query that you have mentioned in the previous post. We have created a sample based on your requirement and the same can be downloaded from the following link:
Sample Link: http://www.syncfusion.com/downloads/support/directtrac/general/CRUD1493267197.zip
In the above sample we have rendered two grids with separate data source, One grid with “Orders” table and the other grid with “Customers” table by passing the separate query for each grid using “query” property of the grid.
Please refer the below code snippet:
<script type="text/javascript"> $(function () { var dataManger = ej.DataManager({ url: "http://mvc.syncfusion.com/Services/Northwnd.svc/" }); var queryOrders = ej.Query().from("Orders").select("OrderID", "CustomerID", "OrderDate", "Employee.FirstName").expand("Employee"); var queryCustomer = ej.Query().from("Customers").select("CustomerID", "CompanyName", "ContactName");
$("#GridOrders").ejGrid({
dataSource: dataManger, query: queryOrders }); $("#GridCustomer").ejGrid({
dataSource: dataManger, query: queryCustomer }); }); </script> |
Please try the above sample and please get back to us if we misunderstood your requirement.
Regards,
Gowthami V.
Hi Sabastian
Thanks for your update.As you suggested in the previous response we will add the “query” option of the ejGrid to javascript class reference document.
Please get back to us if you have any queries we will happy to assist you.
Regards,
Gowthami V.
Hi Sebastian
We have analyzed the query that you have mentioned in the previous post. We have created a sample based on your requirement and the same can be downloaded from the following link:
Sample Link: http://www.syncfusion.com/downloads/support/directtrac/general/CRUD1493267197.zip
In the above sample we have rendered two grids with separate data source, One grid with “Orders” table and the other grid with “Customers” table by passing the separate query for each grid using “query” property of the grid.
Please refer the below code snippet:
<script type="text/javascript">
$(function () {
var dataManger = ej.DataManager({
url: "http://mvc.syncfusion.com/Services/Northwnd.svc/"
});
var queryOrders = ej.Query().from("Orders").select("OrderID", "CustomerID", "OrderDate", "Employee.FirstName").expand("Employee");
var queryCustomer = ej.Query().from("Customers").select("CustomerID", "CompanyName", "ContactName");
$("#GridOrders").ejGrid({
dataSource: dataManger,
query: queryOrders
});
$("#GridCustomer").ejGrid({
dataSource: dataManger,
query: queryCustomer
});
});
</script>
Please try the above sample and please get back to us if we misunderstood your requirement.
Regards,
Gowthami V.
<script src="~/Scripts/jsondata.min.js"></script> <script type="text/javascript"> $(function () { window.rowSelected = function (args) { var juserID = args.data.UserId; var detaildata = ej.DataManager(window.gridData).executeLocal(ej.Query().where("UserId", ej.FilterOperators.equal, juserID, false).take(100)); var gridObj = $("#DetailGrid").ejGrid("instance"); gridObj.dataSource(ej.DataManager(detaildata.slice(0, 5))); } }); </script>
@(Html.EJ().Grid<object>("DetailGrid") .Datasource((IEnumerable<object>)ViewBag.datasource2) . . . . )
<script type="text/javascript"> $(function () { window.rowSelected = function (args) { //Access the variable from the controller var data = @Html.Raw(Json.Encode(ViewBag.dataSource2)); var employeeID = args.data.EmployeeID; var detaildata = ej.DataManager(data).executeLocal(ej.Query().where("EmployeeID", ej.FilterOperators.equal, employeeID, false).take(10)); var gridObj = $("#DetailGrid").ejGrid("instance"); gridObj.dataSource(ej.DataManager(detaildata.slice(0, 5))); } }); </script> |