<script type="text/javascript">
$(function () {
var data = new ej.data.DataManager({
url: '/Home/UrlDatasource',
adaptor: new ej.data.UrlAdaptor(),
crossDomain: true
});
var grid = new ej.grids.Grid({
dataSource: data,
height: 300,
enableVirtualization: true,
toolbar: ['Search'],
pageSettings: { pageSize: 200 },
columns: [
{ field: 'OrderID', headerText: 'Order ID', textAlign: 'Right', width: 120, isPrimaryKey: true },
{ field: 'EmployeeID', width: 140, headerText: 'Employee ID' },
{ field: 'CustomerID', headerText: 'Customer ID', width: 120 }
]
});
grid.appendTo('#Grid');
});
</script> |
Hi Rahul,
Greetings from syncfusion support
Based on your query you have defined all the properties like EJ1 Grid control. In EJ2 Grid to setup the virtualization you need to define enableVirtualization as true and content height by height property.
So we suggest you to follow our Documentation and sample demos to overcome your issue.
For your reference we have prepared a sample of Url adaptor with virtualization. Please refer the below code example, documentation and sample for more information.
<script type="text/javascript">$(function () {var data = new ej.data.DataManager({url: '/Home/UrlDatasource',adaptor: new ej.data.UrlAdaptor(),crossDomain: true});
var grid = new ej.grids.Grid({dataSource: data,height: 300,enableVirtualization: true,toolbar: ['Search'],pageSettings: { pageSize: 200 },columns: [{ field: 'OrderID', headerText: 'Order ID', textAlign: 'Right', width: 120, isPrimaryKey: true },{ field: 'EmployeeID', width: 140, headerText: 'Employee ID' },{ field: 'CustomerID', headerText: 'Customer ID', width: 120 }]});
grid.appendTo('#Grid');
});
</script>
Documentation: https://ej2.syncfusion.com/documentation/grid/virtual/
Regards,
Rajapandi R
<style>
.e-grid.scroll .e-gridcontent {
overflow-x: scroll !important;
overflow-y: scroll !important;
}
.e-grid.scroll .e-gridheader div:first-child {
border-right-width: 1px;
overflow-y: hidden;
overflow-x: hidden;
}
.e-grid.scroll .e-gridheader {
padding-right: 16px;
overflow-y: auto;
overflow-x: auto;
}
</style>
</head>
<body>
<div class="control-section">
<button type="button" onclick="Disable()">Scroll</button>
<div id="Grid">
</div>
</div>
</div>
</div>
<script type="text/javascript">
var virtualData1=[];
$(function() {
dataSource();
$("#Grid").ejGrid({
// the datasource "window.gridData" is referred from jsondata.min.js
dataSource: virtualData1,
allowSorting: true,
allowPaging:true,
pageSettings: { pageSize: 54 },
dataBound: function(args){
this.getContent().height(this.element.parent().height()).width(this.element.parent().width());
this.getHeaderContent().find("div").width(this.element.parent().width() - 17);
this.element.addClass("scroll");
this.getContent().scroll(ej.proxy(function (e) {
this.getHeaderContent().find("div:first-child").scrollLeft($(e.currentTarget).scrollLeft());
}, this));
},
function Disable() {
var grid = $("#Grid").ejGrid("instance");
grid.getContent()[0].scrollTop = 100;
} |
………………….
<button id="scroll">click to scroll</button> // define button here
<div id="Grid"></div>
………………….
<script>
$(function () {
var element = $("#Grid");
element.ejGrid({
allowScrolling: true,
scrollSettings: { width: "auto", height: 300, allowVirtualScrolling: true, virtualScrollMode: ej.Grid.VirtualScrollMode.Continuous},
………………..
$("#scroll").ejButton({
click: function (args) {
var gridInst = $(".e-grid").ejGrid("instance");
var page = gridInst.model.pageSettings.currentPage + 1;
if (page <= gridInst.model.pageSettings.totalPages) {
gridInst.gotoPage(page);
}
}
});</script> |
chartControl1.PrimaryXAxis.ZoomFactor = 0.5;
chartControl1.PrimaryXAxis.ZoomPosition = 0.5;
|