Results 1 to 7 of 7

Thread: grid.rowAt([index]).cellAt([index]) fails with error

  1. #1

    Default grid.rowAt([index]).cellAt([index]) fails with error

    Hello team,

    I am trying to test a Sencha Grid with locked columns.
    When I execute:
    ST.grid("gridpanel").viewReady().rowAt(1).cellAt(4) I am getting the following error:
    "Failed with error "grid.getHeaderContainer(...).getColumns is not a function""

    How can I get a cell of a row and then the text within to be able to compare with with something in an expect?

    Thank you,
    Sergiu

  2. #2
    Sencha - Sales Team daniel.gallo's Avatar
    Join Date
    Apr 2009
    Location
    London, England
    Posts
    396
    Answers
    75

    Default

    Hi Sergiu,

    Which version of Ext JS are you testing against, and if it's Ext JS 6, is this a Classic or Modern app?

    Also, in order to check the contents of a grid's cell matches a particular string, you can use the "text" API, like so:

    Code:
    ST.grid('mygrid')
        .rowAt(1)
        .cellAt(1)
        .text('Voomm');
    If the text in the cell doesn't match, then that will automatically cause a test failure.

    Thanks
    Daniel Gallo

  3. #3

    Default

    Hello Daniel,

    We are using Ext JS 6.2.1.167 Modern app.
    The above example you provided is not working, it fails with the following error: "grid.getHeaderContainer(...).getColumns is not a function"
    Error was already provided in the 1st post.
    Also .text may not be what I am searching for because I need something similar with contains not equals.

    Is there a way to get the text from the row future like we can when we use plain old WebdriverJS?

    Thank you

  4. #4
    Sencha - Sales Team daniel.gallo's Avatar
    Join Date
    Apr 2009
    Location
    London, England
    Posts
    396
    Answers
    75

    Default

    Hi Sergiu,

    In 6.2 Modern the grid doesn't support locked columns, so are you referring to some other type of feature you've enabled on the grid?

    Do you have a Fiddle example that demonstrates the code used for your grid, so I can try and replicate the issue, or do you have the example hosted somewhere?

    The sample test I provided above is correct syntax, so we just need to figure out why it's failing in your case. We also have the textLike API, that lets you do a partial match using either a regular expression or string. See http://docs.sencha.com/sencha_test/2...ethod-textLike.

    Thanks
    Daniel Gallo

  5. #5

    Default

    Hello Daniel,

    Sorry for misleading. it is Ext JS 6.2.1.167 Classic app.

    Issue is stil present. Is there any additional info that may help you here?

    Thank you

  6. #6
    Sencha - Sales Team daniel.gallo's Avatar
    Join Date
    Apr 2009
    Location
    London, England
    Posts
    396
    Answers
    75

    Default

    Thanks for confirming. In order to replicate the issue, please can you provide an example of the grid you're testing, either via a Sencha Fiddle (fiddle.sencha.com), or a copy of the grid code, or a list of the features being used on the grid.
    Daniel Gallo

  7. #7

    Default

    Hello Daniel,

    I cannot provide a Fiddle for the moment as you'll need access to our BE. But I can share with you the code of our Grid.

    Code:
    Ext.define('Acclaim.view.history.search.List', {    extend: 'Ext.grid.Panel',
        xtype: 'history.search.list',
    
        requires: [
            'Acclaim.view.history.search.ListController',
            'Acclaim.grid.TimeagoColumn'
    ],
    
        controller: 'history.search.list',
    
        viewConfig: {
            enableTextSelection: true
    },
    
        cls: 'history-list',
        bbar: [
            {
                xtype: 'button',
                iconCls: 'x-fa fa-trash-o',
                text: 'Clear History',
                handler: 'onClearHistoryClick'
    }, '->',
            {
                xtype: 'radiogroup',
                columns: 2,
                vertical: false,
                reference: 'operandsGroup',
                value: 'AND',
                listeners: {
                    dirtychange: 'onOperandDirtyChange'
    },
                items: [
                    {
                        boxLabel: 'AND (Intersection)',
                        width: 170,
                        name: 'operand',
                        inputValue: 'AND',
                        checked: true
    },
                    {
                        boxLabel: 'OR (Union)',
                        name: 'operand',
                        inputValue: 'OR'
    }
                ]
            },
            {
                xtype: 'button',
                reference: 'searchBtn',
                iconCls: 'x-fa fa-question-circle-o',
                text: 'Search',
                disabled: true,
                handler: 'onSearchClick'
    }
        ],
    
        listeners: {
            itemdblclick: 'onRowDblClick'
    },
    
        columns: [
            {
                xtype: 'timeagocolumn',
                sortable: false,
                menuDisabled: true,
                text: 'Date',
                dataIndex: 'dateSearch',
                format: 'D m-d-Y h:ia',
                width: 120,
                maxWidth: 190
    },
            {
                text: 'Query',
                variableRowHeight: true,
                menuDisabled: true,
                flex: 1,
                renderer: function (val, metadata, record) {
                    var sr = record.get('searchRequest');
                    var query = sr.getUserQuery();
                    var html = Acclaim.util.Renderers.renderSearchConstraints(sr);
                    var moreLikeThis = sr.getMoreLikeThis();
    
                    val = '';
    
                    if (sr.getQueryType() === 'standard') {
                        if (Ext.isEmpty(query) === false) {
                            val = '<div>' + query + '</div>';
                        }
    
                        if (Ext.isEmpty(html) === false) {
                            val += html;
                        }
                    } else {
                        if (moreLikeThis && Ext.isEmpty(moreLikeThis.sourceText) === false) {
                            val += '<div class="truncate"> NLS: ' + moreLikeThis.sourceText + '</div>';
                        }
                    }
                    metadata.css += ' custom-tag-list';
                    return val;
                }
            }
        ],
    
        initComponent: function () {
            var me = this;
            var store = new Ext.data.ChainedStore({
                source: Ext.getStore('searchHistory'),
                filters: [me.filterBlankSearchRequests],
                autoDestroy: true
    });
    
            Ext.apply(me, {
                store: store,
                selModel: {
                    selType: 'checkboxmodel',
                    checkOnly: true,
                    pruneRemoved: false,
                    listeners: {
                        selectionchange: 'onSelectionChange'
    },
                    addCheckbox: function (view) {
                        var renderer;
                        var column;
    
                        this.self.prototype.addCheckbox.call(this, view);
    
                        column = this.column;
                        renderer = column.renderer;
    
                        column.renderer = function () {
                            me.checkColumnRenderer.apply(column, arguments);
    
                            return renderer.apply(column, arguments);
                        };
                    }
                }
            });
    
            me.callParent();
        },
    
        checkColumnRenderer: function (val, meta, record) {
            this.disabled = record.get('searchRequest').getQueryType() !== 'standard';
        },
    
        filterBlankSearchRequests: function (record) {
            var sr = record.get('searchRequest');
    
            return Ext.isEmpty(sr.getUserQuery()) === false
    || Ext.isEmpty(sr.getRefineUIConstraints()) === false
    || Ext.isEmpty(sr.getNumberConstraints()) === false
    || Ext.isEmpty(sr.getSearchConstraints()) === false
    || (sr.getQueryType() === 'mlt' && Ext.isEmpty(sr.getMoreLikeThis().sourceText) === false);
        }
    });
    Thank you,
    Sergiu

Similar Threads

  1. Replies: 2
    Last Post: 16 Sep 2015, 5:48 AM
  2. Grid grouping index error
    By antoine.kahale in forum Ext: Q&A
    Replies: 3
    Last Post: 11 Sep 2013, 12:49 AM
  3. Replies: 1
    Last Post: 7 Nov 2012, 12:25 AM
  4. EditorGrid SelectionModel index vs Store index
    By dardison in forum Sencha GXT Q&A
    Replies: 2
    Last Post: 16 Oct 2009, 1:18 PM
  5. Obtaining a column's numeric index from its data Index
    By cesarulo in forum Ext 1.x: Help & Discussion
    Replies: 15
    Last Post: 1 Jun 2007, 1:34 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •