|
@{
var DDL_TicketDeduction = new Syncfusion.EJ2.DropDowns.DropDownList()
{
DataSource = ViewBag.DeductionTypes,
Query = "new ej.data.Query()",
Fields = new Syncfusion.EJ2.DropDowns.DropDownListFieldSettings()
{
Value = "TaskID",
Text = "DeductionName"
}
};
}
<ejs-treegrid ID="TreeGrid" queryCellInfo="OnQueryCellInfo" ….>
……………….
<e-treegrid-columns>
……………..
<e-treegrid-column field="TaskID" headerText="TaskID" width="180" isPrimaryKey="true" editType="dropdownedit"
edit="new {@params = DDL_TicketDeduction }"></e-treegrid-column>
……………………
</e-treegrid-columns>
</ejs-treegrid>
<script>
……………………………
var ForeignkeyData = @Html.Raw(Json.Serialize(ViewBag.DropData)) // get the ForeignkeyData here.
function OnQueryCellInfo(args) {
if (args.column.field == "TaskID") {
for (var i = 0; i < ForeignkeyData.length; i++) {
if (args.data.TaskID == ForeignkeyData[i].TaskID) {
args.cell.innerText = ForeignkeyData[i].DeductionName; // assign the foreignkey field value to the innertext
}
}
}
}
</script>
|
|
|
|
<script>
function onChange(args) { // dropdown change event
var changedValue = args.value; // args.value is the changed value of dropdown
console.log(changedValue);
var numericTextBoxInstance = document.getElementsByClassName("e-numerictextbox")[0].ej2_instances[0];
// numericTextBox Instance
if (changedValue > 5) { // comparing dropdown value
numericTextBoxInstance.enabled = false; // disabling numericTextBox
} else {
numericTextBoxInstance.enabled = true; // enabling numericTextBox
}
}
</script> |
|
<ejs-treegrid id="TreeGrid" idMapping="TaskId" parentIdMapping="ParentId"
treeColumnIndex="2" actionBegin="begin" actionComplete="complete">
</ejs-treegrid>
<script>
function begin(args) {
if (args.requestType === "beginEdit") {
this.grid.getColumnByIndex(2).allowEditing = false;
// setting allowEditing to false for particular column using method getColumnByIndex of Grid
}
}
</script>
|
|
<script>
function onChange(args) { // dropdown change event
var changedValue = args.value; // args.value is the changed value of dropdown
console.log(changedValue);
}
</script>
|
|
<ejs-treegrid id="TreeGrid" idMapping="TaskId" parentIdMapping="ParentId"
treeColumnIndex="2" actionBegin="begin" actionComplete="complete">
</ejs-treegrid>
<script>
function complete(args) {
if (args.requestType === "save") {
var dropDownData = args.data.EmployeeID;
// we can access changed value of dropdown in actionComplete event also
console.log(dropDownData);
}
}
</script>
|