Results 1 to 6 of 6

Thread: ensureVisible dont scroll to store.last() record in infinite grid

  1. #1
    Sencha User
    Join Date
    Sep 2017
    Posts
    5

    Default ensureVisible dont scroll to store.last() record in infinite grid

    ensureVisible and scrollToRecord function dont work.

    Code:
    	const listView = this.lookup( 'ListOrGridView' )
    	const record = store.last()
    	listView.scrollToRecord( record )
    Does ExtJS7 has any solutions for viewing latest record?

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,449

    Default

    When are you executing this code as it may be too soon. For example, here is a simple example using some local data and some buttons (with and without animation) where it does work:

    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Fullstack Engineer
    ________________
    Modus Create is based on the model of an open source team. We’re a remote, global team of experts in our field. To find out more about the work we do, head over to our website.

    Check out my GitHub:
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    Sep 2017
    Posts
    5

    Default

    thank you for your answer!!

    but i am sorry, not enough words.

    ```
    variableHeights: true,
    infinite: true,
    ```

    this config was needed.

    ex.)
    just added these configs.
    (sorry for i dont know to attach a fiddle link...)
    https://fiddle.sencha.com/#fiddle/2v8p&view/editor

    Code:
    Ext.application({
        name : 'Fiddle',
    
    
        launch : function() {
            Ext.Viewport.add({
                xclass: 'Ext.dataview.List',
                variableHeights: true,
                infinite: true,
                itemTpl: '<div>{i}</div>',
                store: {
                    data: ((i, length) => {
                        const data = [];
    
    
                        while (i < length) {
                            data.push({ i });
    
    
                            i++
                        }
    
    
                        return data;
                    })(0, 1000)
                },
                items: [
                    {
                        xclass: 'Ext.Toolbar',
                        docked: 'top',
                        items: [
                            {
                                xclass: 'Ext.Button',
                                text: 'Scroll To First',
                                handler (btn) {
                                    const list = btn.up('list');
                                    const checkbox = list.down('checkbox');
                                    const record = list.getStore().first();
    
    
                                    list.scrollToRecord(record, checkbox.getChecked());
                                }
                            },
                            {
                                xclass: 'Ext.Button',
                                text: 'Scroll To Last',
                                handler (btn) {
                                    const list = btn.up('list');
                                    const checkbox = list.down('checkbox');
                                    const record = list.getStore().last();
    
    
                                    list.scrollToRecord(record, checkbox.getChecked());
                                }
                            },
                            {
                                xclass: 'Ext.field.Checkbox',
                                checked: true,
                                boxLabel: 'Animation?'
                            }
                        ]
                    }
                ]
            });
        }
    });
    thank you

  4. #4
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,449

    Default

    Yea, the updated code worked up to 6.7 but broke with 7.0. I've logged a request to open a bug.

    For embedding fiddles, do something like:

    [FIDDLE]2v8p[/FIDDLE]

    and the forum will swap that out for the embed.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Fullstack Engineer
    ________________
    Modus Create is based on the model of an open source team. We’re a remote, global team of experts in our field. To find out more about the work we do, head over to our website.

    Check out my GitHub:
    https://github.com/mitchellsimoens

  5. #5
    Sencha User
    Join Date
    Sep 2017
    Posts
    5

    Default

    Thank you so much!

  6. #6
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,449

    Default

    They opened EXTJS-28662 to track this.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Fullstack Engineer
    ________________
    Modus Create is based on the model of an open source team. We’re a remote, global team of experts in our field. To find out more about the work we do, head over to our website.

    Check out my GitHub:
    https://github.com/mitchellsimoens

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
  •