function onRowSelect(args) {
var gridObj = $("#DateGrid").ejGrid("instance");
// Value containst the Id of the clicked client
var value = args.data._id;
var dataManager = ej.DataManager({ url: "@Url.Action("GetDetailData")", adaptor: new ej.UrlAdaptor() });
var query = ej.Query().where("_id", "equal", value);
gridObj.element.ejWaitingPopup("show");//show the popup
var execute = dataManager.executeQuery(query) // executing query
.done(function (e) {
var dataMgr = ej.DataManager({
json: e.result.result,
updateUrl: "/Home/UpdateDate",
insertUrl: "/Home/InsertDate",
removeUrl: "/Home/DeleteDate",
adaptor: "remoteSaveAdaptor"
})
gridObj.element.ejWaitingPopup("hide");//hide the popup
gridObj.model.columns[1].defaultValue = args.data._id;
gridObj.dataSource(dataMgr);
});
}
var flag = true;
function onDataBound(args) {
if (this.initialRender && flag) {
flag = false;
var gridObj = $("#ClientGrid").ejGrid("instance");
gridObj.selectRows(0);
}
}
public ActionResult GetDetailData([FromBody]DataManager value )
{
// TODO: Retrieve detail data for the currently selected client.
// IEnumerable Data = null;
clientRepository = new ClientRepository();
IEnumerable Data = clientRepository.GetAll().ToList();
DataOperations dp = new DataOperations();
if (value.Where != null)
{
Data = dp.PerformWhereFilter(Data, value.Where, value.Where[0].Condition);
}
return Json(new { result = Data });
}
|