@{
var opt = new Syncfusion.JavaScript.Models.DropDownListProperties();
opt.DataSource = ViewBag.dropData;
opt.DropDownListFields.Text = "text";
opt.DropDownListFields.Value = "value";
opt.BeforePopupShown = "beforeOpen"; // Client side event
}
@(Html.EJ().TreeGrid("TreeGridContainer")
//…
)
@(Html.EJ().ScriptManager())
<script type="text/javascript">
function beforeOpen(args) {
var treegridObj = $("#TreeGridContainer").data("ejTreeGrid");
record = treegridObj.model.selectedItem,
dataSource = args.model.dataSource;
data = [];
if (record.level == 0)
data = dataSource.slice(0, 4);
else if (record.level == 1)
data = dataSource.slice(4, 8);
else if (record.level == 2)
data = dataSource.slice(8, 12);
this.setModel({"dataSource": data}); // Update new data in the dropdown list
}
</script> |