Fix grid layout

Hi, 
I wonder if it's possible to fix the scroll bar at the bottom of the table ando only move vertically through the table information.

I want that the scroll bar remains fixed at the bottom because actually when I do zoom to the page, the scroll bar moves and I want it to stay always displayed at the bottom no matter the zoom percentage of the page.





5 Replies

MF Mohammed Farook J Syncfusion Team May 19, 2020 06:39 AM UTC

Hi Edson, 
 
Thanks for contacting Syncfusion support. 
 
Please share the following details to proceed further . 
 
  1. Share the full Grid code example with your layout.
  2. Share the video demonstration about your issue.
  3. Share the sample EJ2 package version.
  4. Share the sample if it possible.
 
 
 
Regards, 
J Mohammed Farook  



ER Edson Rodríguez May 19, 2020 08:50 AM UTC

Actually my page looks like my image and I want to look like the next image.



FS Farveen Sulthana Thameeztheen Basha Syncfusion Team May 20, 2020 02:31 PM UTC

Hi Edson, 

From your shared screenshot, we suspect that you need to render Scrollbar at the top of the Grid. We have achieved your requirement using dataBound event of the Grid. In the dataBound event of the Grid, we have rendered the ejScroller and append it on the top of the Grid. When we scroll the top, the bottom scrollbar moves by the scroll event of the ejScrollBar. When we scroll the bottom, the top scrollbar moves by the scroll jQuery event.     

Refer to the code example: 
App.Component.html 
 
<div id="scroll"></div> 
<ej-grid id="Grid" [dataSource]="gridData" [allowScrolling]="true" (dataBound)="dataBound($event)" [scrollSettings]="scrollSettings" [toolbarSettings]="toolbarItems" > 
    <e-columns> 
 
        <e-column field="Field1" headerText="Employee ID" [isPrimaryKey]="true" width="85" textAlign="right"></e-column> 
        .   .      . 
 
    </e-columns> 
</ej-grid> 

App.Component.ts 

   dataBound(e: any){ 
 
            var width, height, maximum, viewportSize; 
            var gridObj = $(".e-grid").ejGrid("instance"); 
            var scroller = gridObj.getScrollObject(); 
            width = viewportSize = gridObj.model.scrollSettings.width - scroller.model.scrollerSize; 
            height = scroller.model.scrollerSize; 
            maximum = scroller.content()[0]["scrollWidth"];   
           
        $("#scroll").ejScrollBar({   // render the scroller 
            viewportSize: viewportSize,   
            width: width,   
            maximum: maximum - viewportSize,   
            scroll: ej.proxy(scroller._scrollChanged, scroller),   
             
        }); 
        gridObj.element.find(".e-gridheader").append($("#scroll"));   // Append it on the top of the Grid 
  
 
          gridObj.element.find(".e-content").scroll(function(args) { 
 
                var scroller = gridObj.getScrollObject(); 
                var value = scroller.scrollLeft(); 
                var scrollbar = $("#scroll").ejScrollBar("instance");    //Bind scroll event for the scroller 
                scrollbar.scroll(value); 
            }); 
 
        } 

Refer to the screenshot:- 
 
Refer to the API Link:- 

If your requirement is different from above solution, please share us the following details. 

  1. Complete Grid code example with your layout.
  2. Exact scenario you need to achieve.(Please elaborate the issue you have faced/requirement ).
  3. Video Demo to replicate the issue or demonstrate your requirement with screenshot.
  4. Confirm whether you have used EJ1 or EJ2.

Based on the above requested details we will provide solution accordingly. 

Regards, 
Farveen sulthana T 



ER Edson Rodríguez May 26, 2020 06:18 PM UTC

I'm using angular, may I implement the top scroll bar also? My code is the next:

                  <ejs-grid #grid [allowFiltering]='true' width='auto'  height=1000 [dataSource]="ListValor" [filterSettings]='filtro' [toolbar]='toolbar' (toolbarClick)='toolbarClick($event)' [allowSorting]='true' AllowScrolling="True" [allowExcelExport]='true' (dataBound)="dataBound($event)">
                    <e-columns>
                      <e-column field='Machine' headerText='Máq.' width='110'></e-column>
                      <e-column field='Mode' headerText='Modo' width='110' ></e-column>
                      <e-column field='InjectionCode' headerText='Código Inyección' width='150'></e-column>
                      <e-column field='Description' headerText='Descripción' width='138'></e-column>
                      <e-column field='AssembleCode' headerText='Código ASSY' width='150'></e-column>
                      <e-column field='CycleTimeEstimated' headerText='T/C E.' width='120'></e-column>
                      <e-column field='CycleTimeReal' headerText='T/C R.' width='115'></e-column>
                      <e-column field='CavityReal' headerText='Cav.' width='105'></e-column>
                      <e-column field='ProductionPlan' headerText='Plan' width='110'></e-column>
                      <e-column field='ProductionReal' headerText='Prod.' width='110'></e-column>
                      <e-column field='Defects' headerText='Defecto' width='125'></e-column>
                      <e-column field='TestPieces' headerText='Prueba' width='125'></e-column>
                      <e-column field='DefectPercentage' headerText='% def' width='100'></e-column>
                      <e-column field='TotalProduction' headerText='Prod. Total' width='140'></e-column>
                      <e-column field='Accomplishment' headerText='% cum' width='100'></e-column>
                      <e-column field='TotalStand' headerText='T/P Tot.' width='110'></e-column>
                      <e-column field='WorkShift' headerText='Turno' width='130'></e-column>
                      <e-column field='Date' headerText='Fecha' width='130'></e-column>
                    </e-columns>
              </ejs-grid>



  dataBound(args)
  {
    if(this.flag)
    {
      this.flag = false;
      this.grid.sortColumn("Machine","Ascending");
    }


SK Sujith Kumar Rajkumar Syncfusion Team May 27, 2020 01:25 PM UTC

Hi Edson, 
 
In the EJ2 Grid the browser scroll is used. So for achieving this requirement we suggest you to define a duplicate div element to create a scroller on top of the Grid as demonstrated in the below code snippet, 
 
app.component.html 
<div id="scroll_wrapper1"> 
    <div id="scroll_div"></div> 
</div> 
<div id="scroll_wrapper2"> 
    <div id="grid_parent"> 
        <ejs-grid [dataSource]='data' height='100%' width='100%'> 
        </ejs-grid> 
    </div> 
</div> 
 
app.component.ts 
ngOnInit(): void { 
    var wrapper1 = document.getElementById("scroll_wrapper1"); 
    var wrapper2 = document.getElementById("scroll_wrapper2"); 
    wrapper1.onscroll = function() { 
      wrapper2.scrollLeft = wrapper1.scrollLeft; 
    }; 
    wrapper2.onscroll = function() { 
      wrapper1.scrollLeft = wrapper2.scrollLeft; 
    }; 
} 
 
app.component.css 
#scroll_wrapper1, #scroll_wrapper2 { 
  width: 600px; 
  overflow-x: scroll; 
  overflow-y: hidden; 
} 
 
#scroll_wrapper1 { 
  height: 20px; 
} 
 
#scroll_wrapper2 { 
  height: 500px;  
} 
 
#scroll_div { 
  width:800px; 
  height: 20px; 
} 
 
#grid_parent { 
  width:800px; 
  height: 500px; 
  overflow: auto; 
} 
 
We have prepared a sample based on this for your reference. You can find it below, 
 
 
Let us know if you have any concerns. 
 
Regards, 
Sujith R 


Loader.
Up arrow icon