|
@(Html.EJ().Grid<object>("Grid")
.Datasource(((IEnumerable<object>)ViewBag.dataSource1))
...
.Columns(col =>
{
...
col.Field("EmployeeID").HeaderText("Employee Name").
DataSource((IEnumerable<object>)ViewBag.data)
.TextAlign(TextAlign.Left).EditTemplate(a => { a.Create("create").Read("read").Write("write"); }).Add();
})
)
<script>
function create() {
return $("<input>");
}
function read(args) {
var val = args.ejComboBox("value");
return val;
}
function write(args) {
var obj = $('#Grid').ejGrid('instance');
var rowdata = ej.DataManager(args.column[1].dataSource).executeLocal(ej.Query().where("EmployeeID","equal", args.rowdata.EmployeeID));
args.element.ejComboBox({ dataSource: args.column[1].dataSource, width: "100%", fields: { text: "EmployeeID", key: "EmployeeID" }, value: rowdata[0].EmployeeID });//render the combobox inside the write event of editTemplate.
args.element.attr("name", "EmployeeID"); //add the name attribute for the element.
}
</script> |
Hi Nicola,Thank you for contacting Syncfusion support.Query 1: in ID 131885 thread you explained me how to use TreeView inside a DrowDown. Can the same thing be done with the new ComboBox component to searching inside treeview ?
Currently we don’t have any samples to integrate treeview with ComboBox and we are working on the development of DropDownTreeView component which will include the searching functionality as per your requirement. This component will be included in our upcoming release Volume 1, 2018 which will be rolled out by the month of February. We will let you know once it has been rolled out.Query 2: In grid, field edit is possible with the new combobox instead of dropdown?We have analyzed your query and prepared a sample that can be downloaded from the below linkIn this sample we have shown the comboBox for one of the column in grid instead of showing as dropdown list while editing. This can be achieved using EditTemplate feature in grid.Please refer the below code example
@(Html.EJ().Grid<object>("Grid").Datasource(((IEnumerable<object>)ViewBag.dataSource1))....Columns(col =>{...col.Field("EmployeeID").HeaderText("Employee Name").DataSource((IEnumerable<object>)ViewBag.data).TextAlign(TextAlign.Left).EditTemplate(a => { a.Create("create").Read("read").Write("write"); }).Add();}))<script>function create() {return $("<input>");}function read(args) {var val = args.ejComboBox("value");return val;}function write(args) {var obj = $('#Grid').ejGrid('instance');var rowdata = ej.DataManager(args.column[1].dataSource).executeLocal(ej.Query().where("EmployeeID","equal", args.rowdata.EmployeeID));args.element.ejComboBox({ dataSource: args.column[1].dataSource, width: "100%", fields: { text: "EmployeeID", key: "EmployeeID" }, value: rowdata[0].EmployeeID });//render the combobox inside the write event of editTemplate.args.element.attr("name", "EmployeeID"); //add the name attribute for the element.}</script>Please refer the documentation linkRegards,Keerthana.
Hi Nicola,Thanks for your updateQuery 1: NOT works in unobtrusive mode. I tried to use ComboBox alone also, in unobtrusive mode but doesn't works. In chrome console debug i found thisWe have made changes to the sample as mentioned in your update and checked by enabling unobtrusive mode in web.config along with the addition of ej.unobtruisve.min.js. And the controls are rendered fine in this mode. Please ensure whether you have referred unobtrusive script in your sample. If possible share us a runnable sample to reproduce the issue in our end along with product version and jquery version details so that it will be helpful for us to validate.Query 2: SortOrder.None = Ascending, SortOrder.Ascending = None, SortOrder.Descending = DescendingBy default, combobox will be rendered with SortOrder.None and the items will be loaded based on the order in which they are included within combobox. In the provided sample, the items in combobox are already loaded with ascending order hence it seems to be SortOrder.Ascending. Kindly refer to the below sample for clear understanding on working of sortOrder property.In the sample the second item is Tennis and this will remain the same by default. When sortOrder is ascending this will be ordered accordingly.Query 3: If AutoFill=true and AllowCustom=false, why is possible to insert a custom text ?When allowCustom is set to false , the custom text will be present within combobox until the control has been focused out. Once focus out, the combobox will load its previous value in the sample.Please check this scenario with the previously provided sample.Query 4: .If AutoFill=true, why if the text not letter case match , the text is filled but the value is null ?We have confirmed “Value is not set once focus out when casing changes” as a defect and logged defect report. This fix will be included in our upcoming Volume 1, 2018 release.Regards,Keerthana.
<div class="control"> @{ Html.EJ() .ComboBox("select") .Width("100%") .AutoFill() .AllowCustom(false) .Datasource((IEnumerable<EmployeeModel>)ViewBag.data) .ComboBoxFields(f => f.Text("FirstName").Value("EmployeeID")) .Placeholder("Select") .SortOrder(SortOrder.None) .Render(); }