Skip to content

Commit 27dec92

Browse files
author
pipeline
committed
feature(EJ2-4939): spinner component integarted to grid.
1 parent bb1417c commit 27dec92

File tree

6 files changed

+4
-129
lines changed

6 files changed

+4
-129
lines changed

src/grid/hierarchy-plnkr.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/grid/hierarchy.html

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,3 @@
1-
<style>
2-
.waitingpopup {
3-
position: absolute;
4-
top: 0;
5-
left: 0;
6-
background-color: #fff;
7-
border-radius: 50%;
8-
box-shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.2),
9-
0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12);
10-
width: 50px;
11-
height: 50px;
12-
}
13-
14-
.image {
15-
position: absolute;
16-
background-repeat: no-repeat;
17-
background-image: url('src/grid/images/Medium-36px-spin.gif');
18-
background-position: center;
19-
width: 50px;
20-
height: 50px;
21-
padding: 6px;
22-
}
23-
24-
#popup {
25-
position: absolute;
26-
background-color: transparent;
27-
z-index: 100;
28-
}
29-
30-
</style>
311
<div class="control-section">
322
<div class="content-wrapper">
333
<div id="Grid"></div>
@@ -44,7 +14,7 @@
4414
</p>
4515
<p>
4616
In this demo, Three level hierarchy is demonstrated with hierarchical structure Employee -> Orders -> Customers.
47-
Also, we have shown waiting popup when loading detail Grid using <code><a target="_blank" class="code"
17+
Also, we have shown spinner when loading detail Grid using <code><a target="_blank" class="code"
4818
href="http://ej2.syncfusion.com/documentation/grid/api-grid.html#detaildatabound-emittypedetaildataboundeventargs">
4919
detailDataBound</a></code> event. This event triggers at initial expand.
5020
</p>

src/grid/hierarchy.ts

Lines changed: 1 addition & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { Grid, Page, Selection, DetailRow, DetailDataBoundEventArgs } from '@syncfusion/ej2-grids';
1+
import { Grid, Page, Selection, DetailRow } from '@syncfusion/ej2-grids';
22
import { DataManager, ODataV4Adaptor } from '@syncfusion/ej2-data';
3-
import { EmitType } from '@syncfusion/ej2-base';
43
import { employeeData } from './datasource';
54

65
Grid.Inject(Page, Selection, DetailRow);
@@ -19,39 +18,6 @@ this.default = (): void => {
1918
crossDomain: true
2019
});
2120

22-
let popup: HTMLElement = document.createElement('div');
23-
popup.id = 'popup';
24-
let div: HTMLElement = document.createElement('div');
25-
div.id = 'waitingpopup';
26-
div.classList.add('waitingpopup');
27-
let span: HTMLElement = document.createElement('span');
28-
span.classList.add('image');
29-
div.appendChild(span);
30-
popup.appendChild(div);
31-
document.getElementById('Grid').appendChild(popup);
32-
33-
function show(args: DetailDataBoundEventArgs): void {
34-
div = document.getElementById('waitingpopup') || div;
35-
popup = document.getElementById('popup') || popup;
36-
let element: HTMLElement = <HTMLElement>args.detailElement || this.element;
37-
if (!element.querySelector('#popup')) {
38-
element.firstElementChild.appendChild(popup);
39-
}
40-
let width: number = element.offsetWidth;
41-
let height: number = element.offsetHeight;
42-
popup.style.width = width + 'px';
43-
popup.style.height = height + 'px';
44-
popup.style.top = '0px';
45-
popup.style.left = '0px';
46-
div.style.top = (element.offsetHeight / 2 - 25) + 'px';
47-
div.style.left = (element.offsetWidth / 2 - 25) + 'px';
48-
popup.style.display = '';
49-
}
50-
51-
let hide: EmitType<Object> = () => {
52-
popup.style.display = 'none';
53-
};
54-
5521
let grid: Grid = new Grid({
5622
dataSource: employeeData,
5723
allowSorting: true,
@@ -62,17 +28,10 @@ this.default = (): void => {
6228
{ field: 'City', headerText: 'City', width: 110 },
6329
{ field: 'Country', headerText: 'Country', width: 110 }
6430
],
65-
detailDataBound: show,
66-
dataBound: hide,
67-
created: hide,
6831
childGrid: {
6932
dataSource: dataManger,
7033
queryString: 'EmployeeID',
7134
allowPaging: true,
72-
detailDataBound: show,
73-
dataBound: hide,
74-
actionBegin: show,
75-
actionComplete: hide,
7635
columns: [
7736
{ field: 'OrderID', headerText: 'Order ID', textAlign: 'right', width: 120 },
7837
{ field: 'ShipCity', headerText: 'Ship City', width: 120 },
@@ -82,8 +41,6 @@ this.default = (): void => {
8241
childGrid: {
8342
dataSource: dataManger2,
8443
queryString: 'CustomerID',
85-
detailDataBound: show,
86-
dataBound: hide,
8744
columns: [
8845
{ field: 'CustomerID', headerText: 'Customer ID', textAlign: 'right', width: 75 },
8946
{ field: 'Phone', headerText: 'Phone', width: 100 },

src/grid/remotedata-plnkr.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"index.ts":"import { enableRipple } from '@syncfusion/ej2-base';\nenableRipple(true);\nimport { Grid, Page, Selection } from '@syncfusion/ej2-grids';\nimport { DataManager, ODataV4Adaptor } from '@syncfusion/ej2-data';\n\nGrid.Inject(Page, Selection);\n\n/**\n * RemoteData sample\n */\n\n let data: Object = new DataManager({\n url: 'http://services.odata.org/V4/Northwind/Northwind.svc/Products',\n adaptor: new ODataV4Adaptor,\n crossDomain: true\n });\n let grid: Grid = new Grid(\n {\n dataSource: data,\n allowPaging: true,\n actionBegin: show,\n actionComplete: hide,\n created: show,\n dataBound: hide,\n columns: [\n { field: 'ProductID', headerText: 'Product ID', width: 130, textAlign: 'right' },\n { field: 'ProductName', headerText: 'Product Name', width: 170 },\n { field: 'UnitPrice', headerText: 'Unit Price', width: 135, textAlign: 'right', format: 'C2', },\n { field: 'UnitsInStock', headerText: 'Units In Stock', width: 160, textAlign: 'right' },\n {\n field: 'Discontinued', headerText: 'Discontinued', width: 150, textAlign: 'center', type: 'boolean',\n displayAsCheckBox: true\n },\n ],\n pageSettings: { pageCount: 5 }\n });\n grid.appendTo('#Grid');\n function show(): void {\n let div: HTMLElement = document.getElementById('waitingpopup');\n let popup: HTMLElement = document.getElementById('popup');\n let width: number = grid.element.offsetWidth;\n let height: number = grid.element.offsetHeight;\n popup.style.width = width + 'px';\n popup.style.height = height + 'px';\n div.style.top = (height / 2 - 25) + 'px';\n div.style.left = (width / 2 - 25) + 'px';\n popup.style.display = '';\n }\n function hide(): void {\n let popup: HTMLElement = document.getElementById('popup') as HTMLElement;\n popup.style.display = 'none';\n }\n\n\n","index.html":"<!DOCTYPE html><html><head>\n <link href=\"http://npmci.syncfusion.com/packages/production/material.css\" rel=\"stylesheet\">\n <script src=\"https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js\"></script>\n <script src=\"systemjs.config.js\"></script>\n</head>\n<body>\n<style>\n .waitingpopup {\n position: absolute;\n top: 0;\n left: 0;\n background-color: #fff;\n border-radius: 50%;\n box-shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12);\n width: 50px;\n height: 50px;\n }\n \n .image {\n position: absolute;\n background-repeat: no-repeat;\n background-image: url('src/grid/images/Medium-36px-spin.gif');\n background-position: center;\n width: 50px;\n height: 50px;\n padding: 6px;\n }\n \n #popup {\n position: absolute;\n background-color: transparent;\n z-index: 100;\n }\n</style>\n<div class=\"control-section\">\n <div class=\"content-wrapper\">\n <div id=\"Grid\">\n <div id=\"popup\">\n <div id=\"waitingpopup\" class=\"waitingpopup\">\n <span id=\"gif\" class=\"image\"></span>\n </div>\n </div>\n </div>\n </div>\n \n\n</div></body></html>","systemjs.config.js":"System.config({\n transpiler: \"typescript\",\n typescriptOptions: {\n compilerOptions: {\n target: \"umd\",\n module: \"commonjs\",\n moduleResolution: \"node\",\n emitDecoratorMetadata: true,\n experimentalDecorators: true\n }\n },\n paths: {\n \"syncfusion:\": \"http://npmci.syncfusion.com/packages/production/\"\n },\n map: {\n main: \"index.ts\",\n typescript: \"https://unpkg.com/[email protected]/lib/typescript.js\",\n 'plugin-json':'https://cdnjs.cloudflare.com/ajax/libs/systemjs-plugin-json/0.3.0/json.min.js',\n \"@syncfusion/ej2-base\": \"syncfusion:ej2-base/dist/ej2-base.umd.min.js\",\n \"@syncfusion/ej2-buttons\": \"syncfusion:ej2-buttons/dist/ej2-buttons.umd.min.js\",\n \"@syncfusion/ej2-calendars\": \"syncfusion:ej2-calendars/dist/ej2-calendars.umd.min.js\",\n \"@syncfusion/ej2-charts\": \"syncfusion:ej2-charts/dist/ej2-charts.umd.min.js\",\n \"@syncfusion/ej2-circulargauge\": \"syncfusion:ej2-circulargauge/dist/ej2-circulargauge.umd.min.js\",\n \"@syncfusion/ej2-lineargauge\": \"syncfusion:ej2-lineargauge/dist/ej2-lineargauge.umd.min.js\",\n \"@syncfusion/ej2-data\": \"syncfusion:ej2-data/dist/ej2-data.umd.min.js\",\n \"@syncfusion/ej2-dropdowns\": \"syncfusion:ej2-dropdowns/dist/ej2-dropdowns.umd.min.js\",\n \"@syncfusion/ej2-grids\": \"syncfusion:ej2-grids/dist/ej2-grids.umd.min.js\", \n \"@syncfusion/ej2-inputs\": \"syncfusion:ej2-inputs/dist/ej2-inputs.umd.min.js\", \n \"@syncfusion/ej2-lists\": \"syncfusion:ej2-lists/dist/ej2-lists.umd.min.js\",\n \"@syncfusion/ej2-navigations\": \"syncfusion:ej2-navigations/dist/ej2-navigations.umd.min.js\", \n \"@syncfusion/ej2-popups\": \"syncfusion:ej2-popups/dist/ej2-popups.umd.min.js\",\n \"@syncfusion/ej2-excel-export\": \"syncfusion:ej2-excel-export/dist/ej2-excel-export.umd.min.js\",\n \"@syncfusion/ej2-pdf\": \"syncfusion:ej2-pdf/dist/ej2-pdf.umd.min.js\",\n \"@syncfusion/ej2-compression\": \"syncfusion:ej2-compression/dist/ej2-compression.umd.min.js\",\n \"@syncfusion/ej2-file-utils\": \"syncfusion:ej2-file-utils/dist/ej2-file-utils.umd.min.js\"\n },\n meta: { \n '*.json': { loader: 'plugin-json' }\n }\n});\nSystem.import('index.ts').catch(console.error.bind(console));"}
1+
{"index.ts":"import { enableRipple } from '@syncfusion/ej2-base';\nenableRipple(true);\nimport { Grid, Page, Selection } from '@syncfusion/ej2-grids';\nimport { DataManager, ODataV4Adaptor } from '@syncfusion/ej2-data';\n\nGrid.Inject(Page, Selection);\n\n/**\n * RemoteData sample\n */\n\n let data: Object = new DataManager({\n url: 'http://services.odata.org/V4/Northwind/Northwind.svc/Products',\n adaptor: new ODataV4Adaptor,\n crossDomain: true\n });\n let grid: Grid = new Grid(\n {\n dataSource: data,\n allowPaging: true,\n columns: [\n { field: 'ProductID', headerText: 'Product ID', width: 130, textAlign: 'right' },\n { field: 'ProductName', headerText: 'Product Name', width: 170 },\n { field: 'UnitPrice', headerText: 'Unit Price', width: 135, textAlign: 'right', format: 'C2', },\n { field: 'UnitsInStock', headerText: 'Units In Stock', width: 160, textAlign: 'right' },\n {\n field: 'Discontinued', headerText: 'Discontinued', width: 150, textAlign: 'center', type: 'boolean',\n displayAsCheckBox: true\n },\n ],\n pageSettings: { pageCount: 5 }\n });\n grid.appendTo('#Grid');\n\n\n","index.html":"<!DOCTYPE html><html><head>\n <link href=\"http://npmci.syncfusion.com/packages/production/material.css\" rel=\"stylesheet\">\n <script src=\"https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js\"></script>\n <script src=\"systemjs.config.js\"></script>\n</head>\n<body>\n<div class=\"control-section\">\n <div class=\"content-wrapper\">\n <div id=\"Grid\">\n </div>\n </div>\n \n\n</div></body></html>","systemjs.config.js":"System.config({\n transpiler: \"typescript\",\n typescriptOptions: {\n compilerOptions: {\n target: \"umd\",\n module: \"commonjs\",\n moduleResolution: \"node\",\n emitDecoratorMetadata: true,\n experimentalDecorators: true\n }\n },\n paths: {\n \"syncfusion:\": \"http://npmci.syncfusion.com/packages/production/\"\n },\n map: {\n main: \"index.ts\",\n typescript: \"https://unpkg.com/[email protected]/lib/typescript.js\",\n 'plugin-json':'https://cdnjs.cloudflare.com/ajax/libs/systemjs-plugin-json/0.3.0/json.min.js',\n \"@syncfusion/ej2-base\": \"syncfusion:ej2-base/dist/ej2-base.umd.min.js\",\n \"@syncfusion/ej2-buttons\": \"syncfusion:ej2-buttons/dist/ej2-buttons.umd.min.js\",\n \"@syncfusion/ej2-calendars\": \"syncfusion:ej2-calendars/dist/ej2-calendars.umd.min.js\",\n \"@syncfusion/ej2-charts\": \"syncfusion:ej2-charts/dist/ej2-charts.umd.min.js\",\n \"@syncfusion/ej2-circulargauge\": \"syncfusion:ej2-circulargauge/dist/ej2-circulargauge.umd.min.js\",\n \"@syncfusion/ej2-lineargauge\": \"syncfusion:ej2-lineargauge/dist/ej2-lineargauge.umd.min.js\",\n \"@syncfusion/ej2-data\": \"syncfusion:ej2-data/dist/ej2-data.umd.min.js\",\n \"@syncfusion/ej2-dropdowns\": \"syncfusion:ej2-dropdowns/dist/ej2-dropdowns.umd.min.js\",\n \"@syncfusion/ej2-grids\": \"syncfusion:ej2-grids/dist/ej2-grids.umd.min.js\", \n \"@syncfusion/ej2-inputs\": \"syncfusion:ej2-inputs/dist/ej2-inputs.umd.min.js\", \n \"@syncfusion/ej2-lists\": \"syncfusion:ej2-lists/dist/ej2-lists.umd.min.js\",\n \"@syncfusion/ej2-navigations\": \"syncfusion:ej2-navigations/dist/ej2-navigations.umd.min.js\", \n \"@syncfusion/ej2-popups\": \"syncfusion:ej2-popups/dist/ej2-popups.umd.min.js\",\n \"@syncfusion/ej2-excel-export\": \"syncfusion:ej2-excel-export/dist/ej2-excel-export.umd.min.js\",\n \"@syncfusion/ej2-pdf\": \"syncfusion:ej2-pdf/dist/ej2-pdf.umd.min.js\",\n \"@syncfusion/ej2-compression\": \"syncfusion:ej2-compression/dist/ej2-compression.umd.min.js\",\n \"@syncfusion/ej2-file-utils\": \"syncfusion:ej2-file-utils/dist/ej2-file-utils.umd.min.js\"\n },\n meta: { \n '*.json': { loader: 'plugin-json' }\n }\n});\nSystem.import('index.ts').catch(console.error.bind(console));"}

src/grid/remotedata.html

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,6 @@
1-
<style>
2-
.waitingpopup {
3-
position: absolute;
4-
top: 0;
5-
left: 0;
6-
background-color: #fff;
7-
border-radius: 50%;
8-
box-shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12);
9-
width: 50px;
10-
height: 50px;
11-
}
12-
13-
.image {
14-
position: absolute;
15-
background-repeat: no-repeat;
16-
background-image: url('src/grid/images/Medium-36px-spin.gif');
17-
background-position: center;
18-
width: 50px;
19-
height: 50px;
20-
padding: 6px;
21-
}
22-
23-
#popup {
24-
position: absolute;
25-
background-color: transparent;
26-
z-index: 100;
27-
}
28-
</style>
291
<div class="control-section">
302
<div class="content-wrapper">
313
<div id="Grid">
32-
<div id="popup">
33-
<div id="waitingpopup" class="waitingpopup">
34-
<span id="gif" class="image"></span>
35-
</div>
36-
</div>
374
</div>
385
</div>
396
<div id="description">

src/grid/remotedata.ts

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ this.default = (): void => {
1616
{
1717
dataSource: data,
1818
allowPaging: true,
19-
actionBegin: show,
20-
actionComplete: hide,
21-
created: show,
22-
dataBound: hide,
2319
columns: [
2420
{ field: 'ProductID', headerText: 'Product ID', width: 130, textAlign: 'right' },
2521
{ field: 'ProductName', headerText: 'Product Name', width: 170 },
@@ -33,20 +29,5 @@ this.default = (): void => {
3329
pageSettings: { pageCount: 5 }
3430
});
3531
grid.appendTo('#Grid');
36-
function show(): void {
37-
let div: HTMLElement = document.getElementById('waitingpopup');
38-
let popup: HTMLElement = document.getElementById('popup');
39-
let width: number = grid.element.offsetWidth;
40-
let height: number = grid.element.offsetHeight;
41-
popup.style.width = width + 'px';
42-
popup.style.height = height + 'px';
43-
div.style.top = (height / 2 - 25) + 'px';
44-
div.style.left = (width / 2 - 25) + 'px';
45-
popup.style.display = '';
46-
}
47-
function hide(): void {
48-
let popup: HTMLElement = document.getElementById('popup') as HTMLElement;
49-
popup.style.display = 'none';
50-
}
5132
};
5233

0 commit comments

Comments
 (0)