ComboBox populating via ajax

Posted by: mserban on 25 April 2018, 1:00 am EST

    • Post Options:
    • Link

    Posted 25 April 2018, 1:00 am EST

    Hello,

    I’m having this problem: I have a combobox cell that is activated on the click event and I am populating it via an ajax call. When I click on the cell first, all good, the combobox it’s activated and prepopulated with the desired source so when I click on the arrow to show the items they are all there but when I click on the arrow first, the dropdown appears, before the ajax call it’s finished so it shows an empty list.

    Is there any solution for this? Can the popup wait until the ajax it’s completed or can I put some loading stuff?

    Thanks in advance,

    Mircea

  • Posted 26 April 2018, 12:33 am EST

    Hello,

    I would suggest you to show a message in EditStarting event and wait for the ajax call to complete. For example:

    
      var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"));
                var activeSheet = spread.getActiveSheet();
                var items2 = ["a", "ab", "abc", "apple", "boy", "cat", "dog"];
                var eComboBoxCellType = new GC.Spread.Sheets.CellTypes.ComboBox().items(items2).editable(true);
                activeSheet.getCell(1, 3).cellType(eComboBoxCellType);
                activeSheet.setColumnWidth(3, 120);
                activeSheet.bind(GC.Spread.Sheets.Events.EditStarting, function (sender, args) {
    //your ajax call              
      alert("ComboBox is loading.");
                });
               
                activeSheet.bind(GC.Spread.Sheets.Events.EditorStatusChanged, function (e, info) {
                    alert("Column (" + info.newStatus + ")");
                });
    
    

    I hope it helps.

    Thanks,

    Deepak Sharma

  • Posted 28 May 2018, 9:40 pm EST

    Hi there,

    Can you please send me the events order for a combobox? What events occur from the time you click on a combobox until you select a value.

    Thanks,

    Mircea

  • Posted 29 May 2018, 11:45 pm EST

    Hello,

    There are no specific events for combobox , you will have to deal with the Editor/editing events. Like I mentioned in my post above.

    You can check the list of all event here in our online documentation:

    http://help.grapecity.com/spread/SpreadSheets11/webframe.html#SpreadJS~GC.Spread.Sheets.Events.html

    Thanks,

    Deepak Sharma

  • Posted 30 May 2018, 1:15 am EST

    Hello,

    Thank you for your response. What’s the order of the events involved in editor/editing? What’s the first one to occur, until the last one.

    Thanks,

    Mircea

  • Posted 30 May 2018, 1:18 am EST

    I can’t populate the combobox via an ajax call because the dropdown appears before the ajax call finishes and it’s empty. There is a repaint option or something like that? I just want to show the dropdown already populated and I’m currently stuck on this. I tried with your suggestion above but it didn’t work. Any help is appreciated.

    Thanks,

    Mircea

  • Posted 31 May 2018, 10:33 pm EST

    Hello,

    It has been answered here:

    https://www.grapecity.com/en/forums/spread-sheets/how-can-we-populate-a-comb

    Thanks,

    Deepak Sharma

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels