<e-grid-column field="Name" headerText="@Localizer["Name"].Value" width="150" minWidth="8" clipMode="EllipsisWithTooltip" validationRules="@(new { required=true })"></e-grid-column>
|
var entityLookupDDL = new Syncfusion.EJ2.DropDowns.DropDownList() {
Query = "new ej.data.Query().addParams('CatalogGuid', '" + @ViewData["catalogGuid"] + "')",
AllowFiltering = true
};
|
@{
var entityLookupDM = new Syncfusion.EJ2.DataManager { Url = "Home/DropDatasource", Adaptor = "UrlAdaptor" };
var DropDownList = new Syncfusion.EJ2.DropDowns.DropDownList()
{
Query = "new ej.data.Query().addParams('ej2-grid','true')",
AllowFiltering = true
};
}
<div>
<ejs-grid id="Grid" allowPaging="true" allowSorting="true" allowFiltering="true" height="273" toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Cancel", "Update" })">
<e-data-manager url="/Home/GridDatasource" insertUrl="/Home/Insert" updateUrl="/Home/Update" removeUrl="/Home/Delete" adaptor="UrlAdaptor"></e-data-manager>
<e-grid-editSettings allowAdding="true" allowDeleting="true" allowEditing="true" mode="Normal" showConfirmDialog="true" showDeleteConfirmDialog="true"></e-grid-editSettings>
<e-grid-pagesettings pageSize="7"></e-grid-pagesettings>
<e-grid-columns>
<e-grid-column field="OrderID" headerText="Order ID" isPrimaryKey="true" textAlign="Right" width="120"></e-grid-column>
<e-grid-column field="CustomerID" headerText="Customer ID" type="string" width="120"></e-grid-column>
<e-grid-column field="Freight" headerText="Freight" textAlign="Right" format="C2" editType="numericedit" width="120"></e-grid-column>
<e-grid-column field="ShipID" headerText="ShipCity" editType="dropdownedit" foreignKeyField="ShipID" foreignKeyValue="ShipCity" dataSource="entityLookupDM" edit="new {@params = DropDownList }" width="120"></e-grid-column>
</e-grid-columns>
</ejs-grid>
</div> |
|
|
|
@{
var dropdownlist = new Syncfusion.EJ2.DropDowns.DropDownList() { AllowFiltering = true, Fields = new Syncfusion.EJ2.DropDowns.DropDownListFieldSettings() { Value = "EmployeeID", Text = "Name" }, Filtering = "onFiltering" };
}
<div>
<div id="modalDialog"></div>
<ejs-grid id="Grid" dataSource="ViewBag.DataSource" allowResizing="true" allowPaging="true" allowSorting="true" toolbar="@(new List<string>() {"Nuovo","Add", "Edit", "Delete", "Cancel", "Update"})"
>
<e-grid-editSettings allowAdding="true" allowDeleting="true" allowEditing="true" mode="Normal"></e-grid-editSettings>
<e-grid-columns>
<e-grid-column field="OrderID" headerText="Order ID" isPrimaryKey="true" width="120"></e-grid-column>
<e-grid-column field="EmployeeID" foreignKeyField="EmployeeID" foreignKeyValue="Name" dataSource="@(new Syncfusion.EJ2.DataManager() { Url = "Home/GetForeignKetData", Adaptor="UrlAdaptor" })" headerText="Employee ID" editType="dropdownedit" edit="@(new {@params=dropdownlist })" width="120"></e-grid-column>
<e-grid-column field="Freight" headerText="Freight" format="C2" width="120"></e-grid-column>
<e-grid-column field="ShipCity" headerText="Ship City" width="120"></e-grid-column>
<e-grid-column field="ShipCountry" headerText="Ship Country" width="120"></e-grid-column>
</e-grid-columns>
</ejs-grid>
</div>
<script>
function onFiltering(e) {
var query = new ej.data.Query().select(['Name', 'EmployeeID']);
query = (e.text !== '') ? query.where('Name', 'contains', e.text, true) : query; // The query based on search string with filter type
e.updateData(this.dataSource, query); // pass the filter data source, filter query to updateData method
}
</script> |
public IActionResult GetForeignKetData([FromBody]Data dm) {
var val = Customer.GetDropData().ToList();
var Data = val.ToList();
var count = val.Count();
if (dm.where != null && dm.where[0].Operator !=null)
{
// Here, Handle the contains query on the foreignKey data source
Data = (from cust in Data
where cust.Name.ToLower().Contains(querystring)
select cust).ToList();
}
if (dm.take != 0)
Data = Data.Take(dm.take).ToList();
return Json(Data);
} |