BoldSignA modern eSignature application with affordable pricing. Sign up today for unlimited document usage!
(Html.EJ().Grid<object>("Editing") .EditSettings(edit => { edit.AllowAdding().AllowDeleting().AllowEditing() .EditMode(Syncfusion.JavaScript.EditMode.Normal); }) .PageSettings(new Syncfusion.JavaScript.Models.PageSettings { PageSize = 49 }) .ToolbarSettings(toolbar => { toolbar.ShowToolbar().ToolbarItems(items => { items.AddTool(ToolBarItems.Add); items.AddTool(ToolBarItems.Edit); items.AddTool(ToolBarItems.Delete); items.AddTool(ToolBarItems.Update); items.AddTool(ToolBarItems.Cancel); }); }) .AllowPaging(true) .AllowReordering(true) .AllowResizeToFit(true) .EnableAltRow(true) .Columns(col => { col.Field("AccomStatusDesc").HeaderText("Accom Status Desc").Add(); col.Field("AccomStatusGroup").HeaderText("Accom Status Group").Add(); col.Field("OrderIndex").HeaderText("Order Index").EditType(EditingType.Numeric).Add(); }).IsUnbound(true).Add(); }) )
Hi NIck,
Thank you for helping us define this feature. We have added it to our feature
request list and it can be tracked through our Features Management System:
http://www.syncfusion.com/support/directtrac/features/JS-4662
We are closing this incident now. You can communicate with us regarding the
open features at any time using the “Contact” option.
Please let us know if you have any questions about this.
Thanks and Regards,
J.Mohammed Farook
Hi Nick,
We are glad to
let you know that we have achieved your requirement by using the Client Side
Event in “ActionComplete” . Please find the code snippet.
@(Html.EJ().Grid<SampleAutoComplete_f117217.OrdersView>("FlatGrid")
.ClientSideEvents(c => c.ActionComplete("complete"))
.Columns(col =>
{
col.Field("CustomerID").HeaderText("Customer
ID").Width(80).Add();
})) <script type="text/javascript">
function
complete(args)
{ var db = $("#FlatGrid").ejGrid("option", "dataSource"); $("#FlatGridCustomerID").ejAutocomplete({ dataSource: db, fields: { text: "CustomerID"
} }); } </script> |
The above sample, In the grid dataSource
to bind the AutoComplete at that same time the fields is used to
which you want to Suggestions key from the dataSource.
For your
convenience we have created a sample and the same can be downloaded from below
link.
Sample Location:
Please Let us
know if you have any queries,
Regards,
J.Mohammed
Farook,
Hi Prasanthan,
In Grid, we have
default support to render the custom editor(ex: AutoComplete control) in
columns while Adding/Editing the records by enabled the EditTemplate Features. Please refer
to the sample and code example as follows,
Sample: EditTemplate
@(Html.EJ().Grid<MVCSample.OrdersView>("Edittemplate") .Datasource((IEnumerable<object>)ViewBag.datasource) .AllowPaging() .EditSettings(edit => { edit.AllowAdding().AllowDeleting().AllowEditing(); })
.Columns(col => { col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(90).Add(); col.Field("CustomerID").HeaderText("Customer ID").EditTemplate(a => { a.Create("create").Read("read").Write("write"); }).TextAlign(TextAlign.Right).Width(90).Add();
. . .
|
The Create method is used to create the control in initial state. The
Write method will assign the values to ejAutoComplete Control and Read
method will get also display the values.
function return $("<input>"); } //render AutoComplete Control function obj = $('#Edittemplate').ejGrid('instance'); var data = ej.DataManager(obj.model.dataSource).executeLocal(new ej.Query().select("CustomerID")); //bind data to control args.element.ejAutocomplete({ width: "100%", dataSource: data, enableDistinct: true, value: args.rowdata !== undefined ? args.rowdata["CustomerID"] : "" }); } //read the value function args.ejAutocomplete('suggestionList').css('display', 'none'); return args.ejAutocomplete("getValue"); } |
So, you can display the custom editors (like MaskEdit, TimePicker) to the
columns when edit/add the records by using the EditTemplate features. Please refer to the documents & demo in the following
link,
Regards,
Balaji Marimuthu
@(Html.EJ().Grid<MVCSample.OrdersView>("Edittemplate") .Datasource((IEnumerable<object>)ViewBag.datasource) .AllowPaging() .EditSettings(edit => { edit.AllowAdding().AllowDeleting().AllowEditing(); }) .AllowPaging() .Columns(col => { col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(90).Add(); col.Field("CustomerID").HeaderText("Customer ID").EditTemplate(a => { a.Create("create").Read("read").Write("write"); }).TextAlign(TextAlign.Right).Width(90).Add();
. . . }) |
function create() { return $("<input>"); }
//render AutoComplete Control function write(args) { obj = $('#Edittemplate').ejGrid('instance'); var data = ej.DataManager(obj.model.dataSource).executeLocal(new ej.Query().select("CustomerID")); //bind data to control args.element.ejAutocomplete({ width: "100%", dataSource: data, enableDistinct: true, value: args.rowdata !== undefined ? args.rowdata["CustomerID"] : "" }); }
//read the value function read(args) { args.ejAutocomplete('suggestionList').css('display', 'none'); return args.ejAutocomplete("getValue"); } |
@(Html.EJ().Grid<MVCSample.OrdersView>("Edittemplate") .Datasource((IEnumerable<object>)ViewBag.datasource) .Columns(col => { col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(90).Add(); col.Field("EmployeeID").HeaderText("Employee Name").ForeignKeyField("EmployeeID").ForeignKeyValue("FirstName").DataSource((IEnumerable<object>)ViewBag.dataSource2) .TextAlign(TextAlign.Left).Width(90).Add();
. . .
} |
@(Html.EJ().Grid<MVCSample.OrdersView>("Edittemplate") .Datasource(ds => ds.Json((IEnumerable<object>)ViewBag.datasource).BatchURL("/Grid/BatchUpdate").Adaptor(AdaptorType.RemoteSaveAdaptor)) .AllowPaging() .EditSettings(edit => { edit.AllowAdding().AllowDeleting().AllowEditing().EditMode(EditMode.Batch); }) .ToolbarSettings(toolbar => { toolbar.ShowToolbar().ToolbarItems(items => { items.AddTool(ToolBarItems.Add); items.AddTool(ToolBarItems.Edit); items.AddTool(ToolBarItems.Delete); items.AddTool(ToolBarItems.Update); items.AddTool(ToolBarItems.Cancel); }); }) .AllowPaging() .Columns(col => { col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(90).Add(); col.Field("EmployeeID").ForeignKeyField("EmployeeID") .ForeignKeyValue("FirstName").DataSource((IEnumerable<object>)ViewBag.dataSource2).TextAlign(TextAlign.Left).Width(90).Add(); col.Field("Freight").HeaderText("Freight").TextAlign(TextAlign.Right).Width(80).EditType(EditingType.Numeric).Format("{0:C}").Add(); col.Field("ShipName").HeaderText("ShipName").Width(90).Add(); col.Field("ShipCountry").HeaderText("ShipCountry").Width(90).EditType(EditingType.Dropdown).Add(); }) public ActionResult BatchUpdate(List<EditableOrder> changed, List<EditableOrder> added, List<EditableOrder> deleted) { if (changed != null) OrderRepository.Update(changed); if (deleted != null) OrderRepository.Delete(deleted); if (added != null) OrderRepository.Add(added); var data = OrderRepository.GetAllRecords(); return Json(data, JsonRequestBehavior.AllowGet); |
@(Html.EJ().Grid<MVCSample.OrdersView>("Edittemplate") .Datasource(ds => ds.Json((IEnumerable<object>)ViewBag.datasource).BatchURL("/Grid/BatchUpdate").Adaptor(AdaptorType.RemoteSaveAdaptor)) .AllowPaging() .EditSettings(edit => { edit.AllowAdding().AllowDeleting().AllowEditing().EditMode(EditMode.Batch); }) .ToolbarSettings(toolbar => { toolbar.ShowToolbar().ToolbarItems(items => { items.AddTool(ToolBarItems.Add); items.AddTool(ToolBarItems.Edit); items.AddTool(ToolBarItems.Delete); items.AddTool(ToolBarItems.Update); items.AddTool(ToolBarItems.Cancel); }); }) .AllowPaging() .Columns(col => { col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).ValidationRules(v => v.AddRule("required", true).AddRule("number", true)).Width(90).Add(); col.Field("EmployeeID").HeaderText("Freight").ValidationRules(v => v.AddRule("customCompare",5)).TextAlign(TextAlign.Right).Width(80).Add(); col.Field("ShipName").HeaderText("ShipName").Width(90).Add(); col.Field("ShipCountry").HeaderText("ShipCountry").Width(90).EditType(EditingType.Dropdown).Add(); }) <script type="text/javascript">
$(function () {
$.validator.addMethod("customCompare", function (value, element, params) { var obj = $("#Edittemplate").ejGrid("instance"); var arrdata = ej.DataManager(obj.model.dataSource.dataSource.json).executeLocal(new ej.Query().select("EmployeeID")); var batchadded = ej.DataManager(obj.batchChanges.added).executeLocal(new ej.Query().select("EmployeeID")); var batchchanged = ej.DataManager(obj.batchChanges.changed).executeLocal(new ej.Query().select("EmployeeID"));
var data = $.merge(arrdata, batchadded); var data1 = $.merge(data, batchchanged);
if ($.inArray(parseInt(element.value), ej.distinct(data1)) == -1) return true; return false; }, "Please enter new value"); });
</script> |