|
@(Html.EJ().TreeGrid("container")
.Datasource(ds => ds.URL("Home/UrlDataSource")
.Adaptor(AdaptorType.UrlAdaptor))
.ClientSideEvents(eve =>
{
eve.ActionBegin("actionBegin");
})
.FilterSettings(fs => fs.FilterBarMode(TreeGridFilterBarMode.OnEnter))
//..
)
function actionBegin(args) {
if (args.requestType == "filtering") {
args.cancel = true;
var dataManger = ej.DataManager({ url: "Home/NewUrlDataSource", adaptor: new ej.UrlAdaptor() });
var treeObj = $("#container").data("ejTreeGrid");
var query = ej.Query().where(ej.Predicate(args.filterCollection[0].field, ej.FilterOperators.equal, args.filterCollection[0].value, true));
dataManger.executeQuery(query).done(function (e) {
newValue = e.result.result;
treeObj.option("dataSource", newValue);
});
}
}
public ActionResult NewUrlDataSource(DataManager dm)
{
sample s1 = new sample();
IEnumerable DataSource = s1.GetSelfDataSource1();
DataOperations ds = new DataOperations();
List<string> str = new List<string>();
if (dm.Search != null && dm.Search.Count > 0)
{
DataSource = ds.PerformSearching(DataSource, dm.Search);
}
if (dm.Sorted != null && dm.Sorted.Count > 0) //Sorting
{
DataSource = ds.PerformSorting(DataSource, dm.Sorted);
}
if (dm.Where != null && dm.Where.Count > 0) //Filtering
{
DataSource = ds.PerformWhereFilter(DataSource, dm.Where, dm.Where[0].Operator);
}
var count = DataSource.Cast<BusinessObject>().Count();
if (dm.Take != 0)
DataSource = ds.PerformTake(DataSource, dm.Take);
return Json(new { result = DataSource, count = count, });
} |
Hello
Thanks for the reply.
This seems too complicated for this feature, and I'd really like to show the full tree (found record, its children and parents).
I'll
try something using Grid. It's not as nice as TreeGrid, but server-side
filtering works, which is more important for my data, which is quite
large, so that Internet Explorer freezes when it tries to deserialize
all this data.
Thanks,
Tom