This article describes the API migration process of ComboBox component from Essential JS 1 to Essential JS 2.
Behavior | API in Essential JS 1 | API in Essential JS 2 |
---|---|---|
Default | Property: datasourcevar sample = new ej.ComboBox($('#dropdown1'),{dataSource: List}); |
Property: dataSourcelet comboBoxObject = new ComboBox({dataSource: sportsData,});comboBoxObject.appendTo('#cmbelement'); |
Fields for mapping | Property: fieldsvar sample = new ej.ComboBox($('#dropdown1'),{fields: { text: "text", value: "empid" }}); |
Property: fieldslet comboBoxObject = new ComboBox({fields: { text: "text", value: "empid" },});comboBoxObject.appendTo('#cmbelement'); |
Query | Property: queryvar sample = new ej.ComboBox($('#dropdown1'),{query: ej.Query().requiresCount()}) |
Property: querylet comboBoxObject = new ComboBox({query: new Query().from('Customers').select(['ContactName', 'CustomerID']).take(6),});comboBoxObject.appendTo('#cmbelement'); |
Begin event | Event:actionBeginvar sample = new ej.ComboBox($('#dropdown1'),{actionBegin: "begin"}); |
Event: actionBeginlet comboBoxObject = new ComboBox({actionBegin: "begin",});comboBoxObject.appendTo('#cmbelement'); |
Complete event | Event:actionCompletevar sample = new ej.ComboBox($('#dropdown1'),{actionComplete: "begin"}); |
Event: actionCompletelet comboBoxObject = new ComboBox({actionComplete: "begin",});comboBoxObject.appendTo('#cmbelement'); |
Failure event | Event:actionFailurevar sample = new ej.ComboBox($('#dropdown1'),{actionFailure: "begin"}); |
Event: actionFailurelet comboBoxObject = new ComboBox({actionFailure: "begin",});comboBoxObject.appendTo('#cmbelement'); |
Behavior | API in Essential JS 1 | API in Essential JS 2 |
---|---|---|
Default | Property: allowFilteringvar sample = new ej.ComboBox($('#dropdown1'),{allowFiltering: true}); |
Property: allowFilteringlet comboBoxObject = new ComboBox({allowFiltering: true,});comboBoxObject.appendTo('#cmbelement'); |
No records template | Property: noRecordsTemplatevar sample = new ej.ComboBox($('#dropdown1'),{allowFiltering: "<span class='norecord'> NO DATA AVAILABLE</span>"}); |
Property: noRecordsTemplatelet comboBoxObject = new ComboBox({allowFiltering: true,});comboBoxObject.appendTo('#cmbelement'); |
Ignore casing and diacritics | Not Applicable | Property: ignoreAccentlet comboBoxObject = new ComboBox({ignoreAccent: true,});comboBoxObject.appendTo('#cmbelement'); |
Custom value addition | Property: allowCustomvar sample = new ej.ComboBox($('#dropdown1'),{allowCustom: true}); |
https://ej2.syncfusion.com/javascript/demos/#/material/combo-box/custom-value.html |
Search event | Event: filteringvar sample = new ej.ComboBox($('#dropdown1'),{filtering: "filtering"}); |
Event: filteringlet comboBoxObject = new ComboBox({filtering: "filtering",});comboBoxObject.appendTo('#cmbelement'); |
Behavior | API in Essential JS 1 | API in Essential JS 2 |
---|---|---|
Default | Property: itemTemplatevar sample = new ej.ComboBox($('#dropdown1'),{itemTemplate: "<span class='item' ><span class='name'>${FirstName}</span><span class='city'>${City}</span></span>"}); |
Property: itemTemplatelet comboBoxObject = new ComboBox({itemTemplate: "<span class='item' ><span class='name'>${FirstName}</span><span class='city'>${City}</span></span>",});comboBoxObject.appendTo('#cmbelement'); |
Group Template | Property: groupTemplatevar sample = new ej.ComboBox($('#dropdown1'),{groupTemplate: "<strong>${City}</strong>"}); |
Property: groupTemplatelet comboBoxObject = new ComboBox({groupTemplate: "<strong>${City}</strong>",});comboBoxObject.appendTo('#cmbelement'); |
ValueTemplate | Not Applicable | Property: valueTemplatelet comboBoxObject = new ComboBox({valueTemplate: "<span>${FirstName} - ${City}</span>",});comboBoxObject.appendTo('#cmbelement'); |
Header Template | Property: headerTemplatevar sample = new ej.ComboBox($('#dropdown1'),{headerTemplate: "<span class='head'><span class='name'>Name</span><span class='city'>City</span></span>"}); |
Property: headerTemplatelet comboBoxObject = new ComboBox({headerTemplate: "<span class='head'><span class='name'>Name</span><span class='city'>City</span></span>",});comboBoxObject.appendTo('#cmbelement'); |
FooterTemplate | Property: footerTemplatevar sample = new ej.ComboBox($('#dropdown1'),{footerTemplate: "<span class='foot'> Total list items: " + sportsData.length + "</span>"}); |
Property: footerTemplatelet comboBoxObject = new ComboBox({footerTemplate: "<span class='foot'> Total list items: " + sportsData.length + "</span>",});comboBoxObject.appendTo('#cmbelement'); |
No records Template | Property: noRecordsTemplatevar sample = new ej.ComboBox($('#dropdown1'),{noRecordsTemplate: "<span class='norecord'> NO DATA AVAILABLE</span>"}); |
Property: noRecordsTemplatelet comboBoxObject = new ComboBox({noRecordsTemplate: "<span class='norecord'> NO DATA AVAILABLE</span>",});comboBoxObject.appendTo('#cmbelement'); |
Auto fill | Property: autoFillvar sample = new ej.ComboBox($('#dropdown1'),{autoFill: true}); |
Property: autoFilllet comboBoxObject = new ComboBox({autoFill: true,});comboBoxObject.appendTo('#cmbelement'); |
Action failure Template | Property: actionFailureTemplatevar sample = new ej.ComboBox($('#dropdown1'),{actionFailureTemplate: "<span class='action-failure'> Data fetch get fails</span>"}); |
Property: actionFailureTemplatelet comboBoxObject = new ComboBox({actionFailureTemplate: "<span class='action-failure'> Data fetch get fails</span>",});comboBoxObject.appendTo('#cmbelement'); |
Behavior | API in Essential JS 1 | API in Essential JS 2 |
---|---|---|
Default | Property: cssClass var sample = new ej.ComboBox($('#dropdown1'),{cssClass: "className"}); |
Property: cssClasslet comboBoxObject = new ComboBox({cssClass: "className",});comboBoxObject.appendTo('#cmbelement'); |
width | Property: width var sample = new ej.ComboBox($('#dropdown1'),{width: "500px"}); |
Property: Widthlet comboBoxObject = new ComboBox({width: "500px",});comboBoxObject.appendTo('#cmbelement'); |
Behavior | API in Essential JS 1 | API in Essential JS 2 |
---|---|---|
Default | Property: fieldsvar sample = new ej.ComboBox($('#dropdown1'),{fields: { groupBy: "text", value: "empid" }}); |
Property: fieldslet comboBoxObject = new ComboBox({fields: { groupBy: "text", value: "empid" },});comboBoxObject.appendTo('#cmbelement'); |
Behavior | API in Essential JS 1 | API in Essential JS 2 |
---|---|---|
Globalization | Property: localevar sample = new ej.ComboBox($('#dropdown1'),{locale: true}); |
Property: localelet comboBoxObject = new ComboBox({locale: true});comboBoxObject.appendTo('#cmbelement'); |
Rtl support | Property: enableRtlvar sample = new ej.ComboBox($('#dropdown1'),{enableRtl: true}); |
Property: enableRtllet comboBoxObject = new ComboBox({enableRtl: true,});comboBoxObject.appendTo('#cmbelement'); |
Behavior | API in Essential JS 1 | API in Essential JS 2 |
---|---|---|
Watermark text | Property: placeholdervar sample = new ej.ComboBox($('#dropdown1'),{placeholder: "Select"}); |
Property: placeholder let comboBoxObject = new ComboBox({placeholder: "Select",});comboBoxObject.appendTo('#cmbelement'); |
Floating of watermark text | Not applicable | Property: floatLabelTypelet comboBoxObject = new ComboBox({floatLabelType: "Auto",});comboBoxObject.appendTo('#cmbelement'); |
Behavior | API in Essential JS 1 | API in Essential JS 2 |
---|---|---|
Enable/disable | Property: enabledvar sample = new ej.ComboBox($('#dropdown1'),{enabled: true}); |
Property: enabledlet comboBoxObject = new ComboBox({enabled: true,});comboBoxObject.appendTo('#cmbelement'); |
Read only | Property: readOnlyvar sample = new ej.ComboBox($('#dropdown1'),{readOnly: true}); |
Property: readOnlylet comboBoxObject = new ComboBox({readOnly: true,});comboBoxObject.appendTo('#cmbelement'); |
Addition of Html attributes | Property: htmlAttributesvar sample = new ej.ComboBox($('#dropdown1'),{htmlAttributes: { disabled: "disabled"}}); |
Property: htmlAttributeslet comboBoxObject = new ComboBox({htmlAttributes: { disabled: "disabled"},});comboBoxObject.appendTo('#cmbelement'); |
Behavior | API in Essential JS 1 | API in Essential JS 2 |
---|---|---|
Order of sorting | Property: sortOrdervar sample = new ej.ComboBox($('#dropdown1'),{sortOrder: SortOrder.Ascending}); |
Property: sortOrderlet comboBoxObject = new ComboBox({sortOrder: SortOrder.Ascending,});comboBoxObject.appendTo('#cmbelement'); |
Behavior | API in Essential JS 1 | API in Essential JS 2 |
---|---|---|
Selecting particular index | Property: indexvar sample = new ej.ComboBox($('#dropdown1'),{index: 1}); |
Property: indexlet comboBoxObject = new ComboBox({index: 1,});comboBoxObject.appendTo('#cmbelement'); |
Selecting particular value | Property: valuevar sample = new ej.ComboBox($('#dropdown1'),{value: "data"}); |
Property: valuelet comboBoxObject = new ComboBox({value: "data",});comboBoxObject.appendTo('#cmbelement'); |
Selecting particular text | Property: text var sample = new ej.ComboBox($('#dropdown1'),{text: "data"}); |
Property: textlet comboBoxObject = new ComboBox({text: "data",});comboBoxObject.appendTo('#cmbelement'); |
Getting data by using value | Method: getItemDataByValuevar sample = new ej.ComboBox($('#dropdown1'),{}); $(‘#dropdown1’).ejComboBox(‘getItemDataByValue’,“data”) |
Method: getDataByValuelet comboBoxObject = new ComboBox({enabled: true,});comboBoxObject.appendTo('#cmbelement'); comboBoxObject.getDataByValue(“data”); |
Select event | Event: selectvar sample = new ej.ComboBox($('#dropdown1'),{select: "onSelect"}); |
Event: selectlet comboBoxObject = new ComboBox({select: "onSelect",});comboBoxObject.appendTo('#cmbelement'); |
Behavior | API in Essential JS 1 | API in Essential JS 2 |
---|---|---|
Popup height | Property: popupHeightvar sample = new ej.ComboBox($('#dropdown1'),{popupHeight: "300px"}); |
Property:popupheightlet comboBoxObject = new ComboBox({popupHeight: "300px",});comboBoxObject.appendTo('#cmbelement'); |
Popup width | Property: popupWidthvar sample = new ej.ComboBox($('#dropdown1'),{popupWidth: "300px"}) |
Property:popupWidthlet comboBoxObject = new ComboBox({popupWidth: "300px",});comboBoxObject.appendTo('#cmbelement'); |
Popup showing manually | Method: showPopupvar sample = new ej.ComboBox($('#dropdown1'),{}) sample.showPopup(); |
Method: showPopuplet comboBoxObject = new ComboBox({});comboBoxObject.appendTo('#cmbelement'); cmbObj.showPopup(); |
Popup hiding manually | Method: hidePopupvar sample = new ej.ComboBox($('#dropdown1'),{}) sample.hidePopup(); |
Method: hidePopuplet comboBoxObject = new ComboBox({popupHeight: "300px",});comboBoxObject.appendTo('#cmbelement'); comboBoxObject.hidePopup(); |
Popup hide event | Event: closevar sample = new ej.ComboBox($('#dropdown1'),{close: "onClose"}) |
Event: closelet comboBoxObject = new ComboBox({close: "onclose",});comboBoxObject.appendTo('#cmbelement'); |
Popup shown event | Event: openvar sample = new ej.ComboBox($('#dropdown1'),{open: "onOpen"}) |
Event: openlet comboBoxObject = new ComboBox({open: "onOpen",});comboBoxObject.appendTo('#cmbelement'); |
Behavior | API in Essential JS 1 | API in Essential JS 2 |
---|---|---|
Adding new item | Method : addItemvar sample = new ej.ComboBox($('#dropdown1'),{}) sample.addItem({ text :“India”}); |
Method: addItemlet comboBoxObject = new ComboBox({});comboBoxObject.appendTo('#cmbelement'); comboBoxObject.addItem({Id: ‘id’, Game: ‘Golf’},2); |
Focus out event | Not applicable | Event: Blurlet comboBoxObject = new ComboBox({blur: "onclose",});comboBoxObject.appendTo('#cmbelement'); |
Focus in event | Event: focusvar sample = new ej.ComboBox($('#dropdown1'),{focus:"focus"}) |
Event: focusInlet comboBoxObject = new ComboBox({focusIn: "focus",});comboBoxObject.appendTo('#cmbelement'); |
Focus out | Method: focusOutvar sample = new ej.ComboBox($('#dropdown1'),{}) sample.focusOut(); |
Method: focusOutlet comboBoxObject = new ComboBox({open: "onOpen",});comboBoxObject.appendTo('#cmbelement'); comboBoxObject.focusOut(); |
Focus in | Method: focusInvar sample = new ej.ComboBox($('#dropdown1'),{}) sample.focusIn(); |
Method: focusInlet comboBoxObject = new ComboBox({});comboBoxObject.appendTo('#cmbelement'); comboBoxObject.focusIn(); |
Getting the data | Method : getItemsvar sample = new ej.ComboBox($('#dropdown1'),{}) sample.getItems(); |
Method: getItemslet comboBoxObject = new ComboBox({});comboBoxObject.appendTo('#cmbelement'); comboBoxObject.getItems(); |
Create event | Event: createvar sample = new ej.ComboBox($('#dropdown1'),{create:"onCreate"}) |
Event: createdlet comboBoxObject = new ComboBox({created: "oncreate",});comboBoxObject.appendTo('#cmbelement'); |
Change event | Event: changevar sample = new ej.ComboBox($('#dropdown1'),{focus:"focus"}) |
Event: changelet comboBoxObject = new ComboBox({change: "onchange",});comboBoxObject.appendTo('#cmbelement'); |
Custom value event | Event: customValueSpecifiervar sample = new ej.ComboBox($('#dropdown1'),{customValueSpecifier:"customValueSpecifier"}) |
Event: customValueSpecifierlet comboBoxObject = new ComboBox({customValueSpecifier: "customValueSpecifier",});comboBoxObject.appendTo('#cmbelement'); |