let grid:Grid = new Grid({
allowFiltering:true,
columns: [
{ field: 'OrderID', headerText: 'Order ID', width: 120, textAlign: 'Right' },
{ field: 'CustomerID', headerText: 'Customer Name', width: 150 },
{ field: 'OrderDate', headerText: 'Order Date', width: 130, format: 'yMd', textAlign: 'Right' },
],
created:(e)=>{
// setting new dataSource to Grid will automatically refresh it.
grid.dataSource =order;
}
});
grid.appendTo('#Grid');
|
var data =[];
var grid = new ej.grids.Grid({
dataSource: data,
columns: [
. . .
],
created:(e)=>{
// setting data at initial rendering
grid.dataSource = window.hierarchyOrderdata;
}
});
grid.appendTo('#Grid');
document.getElementById('data').addEventListener("click",(e)=>{
// setting data after Grid is rendering
grid.dataSource = window.orderData.slice(5,10);
})
|
Index.js
ej.grids.Grid.Inject(ej.grids.Resize);
var button = new ej.buttons.Button();
button.appendTo('#element');
button.element.onclick=function(){
grid.dataSource=data
};
var grid = new ej.grids.Grid({
dataSource: [],
columns: [
{ field: 'OrderID', headerText: 'Order ID', width: 140 },
-------
],
height: 315
});
grid.appendTo('#Grid');
|