Get help with testing, discuss unit testing strategies etc.


Post by jflowers45 »

Is t.getCell() supported with a buffered, grouped grid?
The following works on a grid with 500 rows, paginated from 80k records
t.getCell('supplywrgrid[title=Supply Staff Work]', 20, 0);
However, using a later row (unrendered) doesn't work- even if I programatically scroll to the row ahead of time and wait for any period of time:
t.getCell('supplywrgrid[title=Supply Staff Work]', 80, 0);
I tried to check what works with normal grid code, and found the following
row = grid.getView().getRow(20); //works
row = grid.getView().getRow(80); //fails

If I want to use row 80, I can do this
grid.ensureVisible(80, { 
	animate:false, 
	select:true,
	callback:function() { 
	     row = grid.getView().getRow(80); //works
        t.getCell('supplywrgrid[title=Supply Staff Work]', 80, 0); //returns undefined
        next();
	}
}); 
Any ideas?

Post by mats »

It's not supposed to work no, not with virtualized scrolling. You should always use ensureVisible first as you did there.

Post by jflowers45 »

Mats, thanks for the quick response. I think I was a bit unclear. What's confusing me is that when I use ensureVisible, I can use the built in getRow() method successfully, but not t.getCell because it returns undefined.
grid.ensureVisible(80, { 
   callback:function() { 
        row = grid.getView().getRow(80); //works
cell = t.getCell('supplywrgrid[title=Supply Staff Work]', 80, 0); //returns undefined
I would have thought that t.getCell would work inside of the ensureVisible callback and was checking whether that's supposed to be the case. If it's not, I'll work around it. If it should work, and it's not easy for you to confirm, let me know and I can try to create a zip file of a test case.

Post by nickolay »

Inside the callback of the "ensureVisible", there, `t.getCell(grid, 80, 0)` should work. If it does not, please provide a test case, yes.

Post by jflowers45 »

Here is a web hosted demo of the problem
https://flashysubstance.com/sandbox/buff ... ridfail.js

And here's a zip file if you want to download and run it locally.
https://www.dropbox.com/s/tme7r5qteovvk ... t.zip?dl=0

I based this off the buffered store demo @
https://examples.sencha.com/extjs/6.5.1 ... store.html

Post by nickolay »

Thank you for the report and the great test case! It seems the buffered grid use case was never supported actually - Siesta just tries to get the 80-th row dom element in the grid view. This is of course incorrect for buffered grid, where 80-th row in the dataset can correspond to dom element at some other ordinal position.

I'll check how this can be fixed and post the patch here.

Post by nickolay »

The following patch for the "siesta-all.js" file fixes the problem for me (will be available in the next release), please verify.
        getRow : function (grid, index) {
            var Ext         = this.Ext();

            grid            = this.normalizeComponent(grid);

            var domNode;

            // Sencha Modern
            if (Ext.grid.Grid && (grid instanceof Ext.grid.Grid)) {
                var rowCmp  = grid.getViewItems()[ index ];

                domNode     = rowCmp && rowCmp.element;
            } else {
                // Sencha Classic
                // if this is a locking grid, grab from locked grid
                grid        = grid.lockedGrid || grid;

                if (grid.getView().bufferedRenderer) {
                    var record  = grid.getStore().getRange(index, index + 1)[ 0 ]

                    if (record) {
                        domNode = grid.getView().getNode(record)
                    }
                } else
                    domNode     = grid && this.$(grid.getView().itemSelector, grid.getView().getEl().dom)[ index ];
            }

            return domNode && Ext.get(domNode);
        },

Post by jflowers45 »

Your patch worked perfectly. You're very welcome for the report - I really appreciate how consistenly responsive your team has been to questions.

Post by nickolay »

Thank you, glad it works!

Post Reply