Search code examples
extjssencha-testsencha-test-2.1

Reference a combobox within a grid row using Sencha Test


Reference a combobox within a grid row using Sencha Test.

Given something like:

{
            text: "Select one",
            width: 110,
            editor: {
                field: {
                    xtype: 'combobox',
                    editable: true,
                    valueField: 'val',
                    displayField: 'name',
                    store: {
                        fields: ['val', 'name'],
                        data: [
                            [0, 'Option 1'],
                            [1, 'Option 2'],
                            [2, 'Option 3']
                        ]
                    }
                }
            }         
        }

So far I can't reference the combo that gets activated once you click on a cell.

This is using a cellediting plugin.

 plugins: {
        ptype: 'cellediting',
        clicksToEdit: 1
    },

So I'm trying to select one of those values from there using ST. So far no luck. I'm only able to activate the cellediting plugin doing something like:

this.grid().rowAt(index).cellAt(1).click();

Solution

  • Added an itemId to the combobox and did this:

    this.grid().rowAt(index).cellAt(1).click();
    ST.comboBox('combobox[itemId=someValue]').visible().expand().setValue(1);
    

    (this refers to a PageObject)