Jump to content

UniDbGrid


rtalmeida

Recommended Posts

4 hours ago, rtalmeida said:

is it possible to capture the unidbgrid scroll event?

Hi,

One possible solution:

function afterCreate(sender)
{
    // you can use 'scrollend' or 'scroll' events
    sender.getView().on('scrollend', function(view, scrollX, scrollY) {
        //ajaxRequest
    });
}

 

Link to comment
Share on other sites

42 minutes ago, rtalmeida said:

Is it possible to give me an example with more details? I need that when scrolling the mouse the records accompany.

You can pass scroll positions: 

scrollX, scrollY

Or what do you mean?

Link to comment
Share on other sites

7 hours ago, rtalmeida said:

Sorry to bother, but my client insists that it works as it is on the desktop, if it is not possible I will change the strategy

Try this...

function afterCreate(sender) {
    var grid = sender;

    sender.getView().on('scrollend', function(view, scrollX, scrollY) {
        var vTop = grid.view.el.getTop(),
            vBottom = grid.view.el.getBottom(),
            top, bottom, hHeight = grid.headerCt.getHeight();


        Ext.each(grid.view.getNodes(), function(node) {
            if (!top && Ext.fly(node).getTop() > vTop) {
                top = grid.view.getRecord(node).data._r;
            }
            if (Ext.fly(node).getBottom() - Ext.fly(node).getHeight() < vBottom) {
                bottom = grid.view.getRecord(node).data._r;
            }
        });

        if (top != 1) {
            top += 1;
        }
        bottom += 1;
        
        if (top == 1) {
            grid.getSelectionModel().select(0)
        } else if (bottom == grid.getStore().count()) {
            grid.getSelectionModel().select(grid.getStore().count())
        } else {
            grid.getSelectionModel().select(Math.round((bottom + top) / 2))
        }

        grid.ensureVisible(grid.getSelection()[0]);
    });
}

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...