@{
var entityLookupDM = new Syncfusion.EJ2.DataManager { Url = "ProductList", Adaptor = "UrlAdaptor" };
var DropDownList = new Syncfusion.EJ2.DropDowns.DropDownList()
{
Query = "new ej.data.Query().addParams('ej2-grid','true')",
AllowFiltering = true,
Change = "saleItemCodeChanged",
Id = "saleItemCodeDropDown",
DataSource = entityLookupDM
};
}
<script>
function saleItemCodeChanged(args) {
if (typeof args != 'undefined') {
data = args.itemData;
if (typeof data != 'undefined') {
var itemDescription = data.ItemDescription;
var onHand = data.OnHand;
var rrp = data.RRP;
var saleGrid = document.getElementById('saleGrid');
if (typeof saleGrid != 'undefined') {
}
}
}
}
</script>
<div class="form-row">
<ejs-grid id="saleGrid" toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Update", "Cancel" })" allowPaging="true" height="200">
<e-data-manager url="/Sale/GetOrder/@Model.SalesOrderNumber" updateUrl="/Sale/UpdateOrder/" insertUrl="/Sale/NewOrder" adaptor="UrlAdaptor" crossdomain="true"></e-data-manager>
<e-grid-editSettings allowAdding="true" allowDeleting="true" allowEditing="true" newRowPosition="Top"></e-grid-editSettings>
<e-grid-pagesettings pageCount="10"></e-grid-pagesettings>
<e-grid-columns>
<e-grid-column field="SalesItemListNumber" isPrimaryKey="true" headerText="Item" validationRules="@(new { required=true, number=true})" width="30" allowEditing="false"></e-grid-column>
<e-grid-column field="ItemCode" headerText="Code" ejs-for="ItemCode" validationRules="@(new { required=true})" editType="dropdownedit"
edit="@(new {@params = DropDownList})" width="250"></e-grid-column>
<e-grid-column field="Description" headerText="Description" textAlign="Right"width="140" allowEditing="false"></e-grid-column>
<e-grid-column field="Quantity" headerText="Quantity" ejs-for="Quantity" width="30" allowEditing="false"></e-grid-column>
<e-grid-column field="RRP" headerText="Unit Price" width="160" ejs-for="UnitPrice" allowEditing="false"></e-grid-column>
<e-grid-column field="Discount" headerText="Disc" format="C2" editType="numericedit" width="150"></e-grid-column>
<e-grid-column field="Tax" headerText="Tax"></e-grid-column>
</e-grid-columns>
</ejs-grid>
When adding a new row, empty row is presented with a drop down list. On selecting a value from drop down list, want 3 read only fields to be updated. How do Iachieve this?
Thanks
Sanjay