Hybrid View

  1. #1
    Sencha User
    Join Date
    Jul 2011
    Location
    Moscou
    Posts
    11
    Vote Rating
    1
    mr.Eugens is on a distinguished road

      0  

    Question Extjs 4, grid.getView().on('bodyscroll', function(event, target)

    Extjs 4, grid.getView().on('bodyscroll', function(event, target)


    There are 2 tables with same number of notes and joint store. It is nesessury to synchronize the position of vertical scroll and the current line.
    For extjs3 the code was
    Code:
    grid1.on('bodyscroll', function(scrollLeft, scrollTop){
         grid2.getView().scroller.scrollTo('top', scrollTop);
    });
    
    grid2.on('bodyscroll', function(scrollLeft, scrollTop){
         grid1.getView().scroller.scrollTo('top', scrollTop);
    });
    For extjs4 I did the following (I had to enter additional conditions to avoid resonance)
    Code:
    Ext.FocusManager.enable();
    ...
    grid1.getView().on('bodyscroll', function(event, target){
    var foc_el = Ext.FocusManager.focusedCmp;
    if (foc_el)
    {
      if ((foc_el.id=='grid1')|| (foc_el.id == grid1.getView().id))
      {
        grid2.setScrollTop(target.scrollTop);
      }
    }
    });
    
    grid2.getView().on('bodyscroll', function(event, target){
    var foc_el = Ext.FocusManager.focusedCmp;
    if (foc_el)
    {
      if ((foc_el.id=='grid2')|| (foc_el.id == grid2.getView().id))
      {
        grid1.setScrollTop(target.scrollTop);
      }
    }
    });
    But for example whole scrolling under IE7 foc_el - null . Is there any optimal method?
    Sorry for my english.

  2. #2
    Sencha User
    Join Date
    Jul 2011
    Location
    Moscou
    Posts
    11
    Vote Rating
    1
    mr.Eugens is on a distinguished road

      0  

    Default


    Question in unequivocal definition of focus of the current table.

  3. #3
    Sencha User
    Join Date
    Jul 2011
    Location
    Moscou
    Posts
    11
    Vote Rating
    1
    mr.Eugens is on a distinguished road

      1  

    Default


    Code:
    grid_ds_deliv.getView().on('bodyscroll', function(event, target){
    if (gl_gscr=='') gl_gscr = 'g1';
    if (gl_gscr == 'g1') grid_ds_pld.setScrollTop(target.scrollTop);
    gl_gscr = '';
    });
    
    grid_ds_pld.getView().on('bodyscroll', function(event, target){
    if (gl_gscr=='') gl_gscr = 'g2';
    if (gl_gscr == 'g2') grid_ds_deliv.setScrollTop(target.scrollTop);
    gl_gscr = '';
    });

  4. #4
    Sencha User
    Join Date
    Feb 2012
    Posts
    219
    Vote Rating
    5
    webfriend13 is on a distinguished road

      0  

    Default


    I ran into same issue. What is the solution to this problem?

  5. #5
    Sencha User
    Join Date
    Nov 2012
    Posts
    1
    Vote Rating
    0
    val360 is on a distinguished road

      0  

    Default My solution FWIW

    My solution FWIW


    Code:
            dataGrid.getView().on('bodyscroll', function (event,target) {		gridA.scrollByDeltaY(target.scrollTop - gridB.getView().getEl().getScroll().top);
    	});
    	entryGrid.getView().on('bodyscroll', function (event, target) {
    		gridB.scrollByDeltaY(target.scrollTop - gridA.getView().getEl().getScroll().top);
    	});

Thread Participants: 2