Dear Punniyamoorthi,
I have been trying to adapt your solution to my webapp, unsuscesfully.
I going to copy the code so we can check if I'm doing something wrong.
this is the "primary" web site with the list of checklists to be fullfilled:
public ActionResult ChecklistIndex()
{
var lista = DBqms.Checklist_Data.ToList();
ViewBag.datasource = lista;
return View();
}
@(Html.EJ().Grid<blendhub.libreria.Checklist_Data>("FlatGrid")
.Datasource(datasource => datasource.Json((IEnumerable<blendhub.libreria.Checklist_Data>
)ViewBag.datasource)
.Adaptor(AdaptorType.RemoteSaveAdaptor))
/* Code removed to make it sorter in this post */
.Columns(col =>
{
col.Field(s => s.IdChecklist)
.Format("<a rel='nofollow' href=\"/Checklist/ChecklistData/{IdChecklistData}\">Answer</a>")
.IsPrimaryKey(true).AllowEditing(false).Visible(true).HeaderText("Checklist ID").Width(100).Add();
col.Field(s => s.Nombre).HeaderText("Name").Width(150).Add();
col.Field(s => s.FechaRegistro).HeaderText("Record date").Width(150).Add();
col.Field(s => s.Usuario).HeaderText("User").Width(150).Add();
})
)
/* In red and green the code where I create the link to be click on the website and open the new view with parameters */
And now, where I have the problem, loading the detail website.
@using Syncfusion.JavaScript
@using Syncfusion.JavaScript.Models
@using Syncfusion.MVC.EJ
<div>
<h4>@ViewBag.Title</h4>
<hr />
<div>
<p style="text-align:right;">
@Html.ActionLink("Back to Checklist", "ChecklistIndex", "CheckList", null, new { @class = "btn btn-default" })
</p>
</div>
@(Html.EJ().TreeGrid("TreeGridContainer")
.IdMapping("IdChecklistItem")
.ParentIdMapping("IdChecklistSeccion")
.Query("new ej.Query().take(29).addParams('id', 8)") /* The id number has to be replaced by the url parameter */
.TreeColumnIndex(1)
.IsResponsive(true)
.Columns(co =>
{
co.Field("IdChecklistSeccion").HeaderText("Task Id").EditType(TreeGridEditingType.Numeric).Width(45).ValidationRules(v => v.AddRule("required", true)).Add();
co.Field("Nombre").HeaderText("Task Name").ValidationRules(v => v.AddRule("required", true)).Add();
co.Field("Valor").HeaderText("Start Date").EditType(TreeGridEditingType.String).Add();
co.Field("Comentario").HeaderText("End Date").EditType(TreeGridEditingType.Numeric).ValidationRules(v => v.AddRule("required", true)).Add();
})
.EditSettings(edit =>
{
edit.AllowEditing(true);
edit.AllowAdding(true);
edit.AllowDeleting(true);
edit.ShowDeleteConfirmDialog(true);
edit.EditMode(TreeGridEditMode.CellEditing);
edit.RowPosition(TreeGridRowPosition.Top);
})
.SizeSettings(ss => ss.Width("100%").Height("350px"))
.ToolbarSettings(tool =>
{
tool.ShowToolbar(true);
tool.ToolbarItems(new List<TreeGridToolBarItems>()
{
TreeGridToolBarItems.Add,
TreeGridToolBarItems.Edit,
TreeGridToolBarItems.Delete,
TreeGridToolBarItems.Update,
TreeGridToolBarItems.Cancel,
TreeGridToolBarItems.ExpandAll,
TreeGridToolBarItems.CollapseAll
});
})
.Datasource(ds => ds.URL("DataSourceCLID").UpdateURL("UpdateCLID").BatchURL("BatchUpdateCLID").Adaptor(AdaptorType.UrlAdaptor))
)
</div>
<style>
.e-grid td {
font-family: Calibri !important;
font-size: 12px !important;
}
.e-grid .e-headercelldiv {
font-size: 12px;
color: red;
}
.e-hover {
color: brown !important;
background-color: red !important;
}
.e-grid-icon.e-groupheadercell {
font-size: 10px;
color: red;
}
</style>
and the c# code:
private int idCheckListData = 0;
//This function works.
public ActionResult ChecklistData (int id)
{
idCheckListData = id;
return View();
}
//Never loads...?
public ActionResult DataSourceCLID(DataManager dm, int id)
{
ViewBag.datasourceCL = DBqms.Checklists;
ViewBag.datasourceCLS = DBqms.Checklist_Seccion;
ViewBag.datasourceCLI = DBqms.Checklist_Item;
ViewBag.Title = DBqms.Checklist_Data.FirstOrDefault(x => x.IdChecklistData == id).Nombre;
var lista = DBqms.Checklist_Item_Data.Where(x => x.IdChecklistData == id);
var count = lista.Count();
return Json(new { result = lista, count = count }, JsonRequestBehavior.AllowGet);
}