I am new to SPEAK and trying to implement a module. I have a combo-box which will list item names. I am trying to add items to combo-box through JavaScript but items are not getting added. Below is my code

define(["sitecore"], function (Sitecore) {
var model = Sitecore.Definitions.Models.ControlModel.extend({
    initialize: function (options) {
        app = this;
        this.set("itemlist", "");
        this.on("change:itemlist", this.FillItems, this);
         var tmpData = '{ "items" : [' +
        '{ "itemId":"{E932156B-3269-44AB-ADB2-60E50C56730A}" , "itemName":"My item 1" },' +
        '{ "itemId":"{DB534C88-F1D2-4BC5-B5A6-AF341E331432}" , "itemName":"My item 2" }]}';
        var obj = JSON.parse(tmpData);

var view = Sitecore.Definitions.Views.ControlView.extend({
    initialize: function (options) {

Sitecore.Factories.createComponent("ItemsList", model, view, ".sc-ItemsList");});

Can anyone tell what I have done wrong in this code?.

  • 1
    Can you use the following this.viewModel.app.ComboBox1.DynamicData = obj; instead of this.viewModel.app.ComboBox1.viewModel.rebind(obj,null,null,"itemName","itemId"); Sep 12, 2017 at 7:07
  • @HishaamNamooya. I tried, but still items are not getting added to the ComboBox.
    – Ramesh
    Sep 12, 2017 at 8:29
  • Can you just call the FillItems function instead from the on change event for testing. Because from the code you shared, it seems that the drop down will get populated when the change event is triggered Sep 12, 2017 at 20:42
  • FillItems function getting called with my above code itself. I have tried to call the function without change event also. But both are not filling the comboBox.
    – Ramesh
    Sep 13, 2017 at 4:59

1 Answer 1


As I was looking a way to achieve this, I found this post and as a basis to get started. Using the rebind method, a simple array is sufficient to be used for obj.

var obj = [
{ "itemId":"{E932156B-3269-44AB-ADB2-60E50C56730A}" , "itemName":"My item 1" },
{ "itemId":"{DB534C88-F1D2-4BC5-B5A6-AF341E331432}" , "itemName":"My item 2" }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.