Skip to content

Commit 510df28

Browse files
928535: To update code snippets for Core Pivot Table UG documentation
1 parent b2aa085 commit 510df28

File tree

7 files changed

+35
-67
lines changed

7 files changed

+35
-67
lines changed

ej2-asp-core-mvc/code-snippet/pivot-table/data-binding/odata/tagHelper

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<ejs-pivotview id="PivotView" height="300">
22
<e-datasourcesettings>
3-
<e-data-manager url="https://js.syncfusion.com/demos/ejServices/Wcf/Northwind.svc/Orders/" adaptor="ODataAdaptor" crossdomain="true"></e-data-manager>
3+
<e-data-manager url="https://services.syncfusion.com/js/production/api/Orders" adaptor="ODataAdaptor" crossdomain="true"></e-data-manager>
44
<e-rows>
55
<e-field name="ShipCountry"></e-field>
66
<e-field name="ShipCity"></e-field>

ej2-asp-core-mvc/code-snippet/pivot-table/editing/Inline-editing/tagHelper

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@
66
</e-formatsettings>
77
<e-rows>
88
<e-field name="Country"></e-field>
9+
<e-field name="Product"></e-field>
910
</e-rows>
1011
<e-columns>
11-
<e-field name="Date"></e-field>
12-
<e-field name="Product"></e-field>
12+
<e-field name="Year"></e-field>
13+
<e-field name="Quarter"></e-field>
1314
</e-columns>
1415
<e-values>
15-
<e-field name="Quantity" caption="Units Sold"></e-field>
16+
<e-field name="Sold" caption="Units Sold"></e-field>
1617
<e-field name="Amount" caption="Sold Amount"></e-field>
1718
</e-values>
1819
</e-datasourcesettings>

ej2-asp-core-mvc/code-snippet/pivot-table/field-list/static-fieldlist-virtualization/tagHelper

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<ejs-pivotview id="PivotView" enablevirtualization="true" enginePopulated="onGridEnginePopulate" height="300"></ejs-pivotview>
22
<br />
33
<ejs-pivotfieldlist id="PivotFieldList" renderMode="Fixed" load="onLoad" enginePopulated="onFieldListEnginePopulate">
4-
<e-datasourcesettings dataSource="data(1000)" expandAll="false" enableSorting="true">
4+
<e-datasourcesettings dataSource="@ViewBag.DataSource" expandAll="false" enableSorting="true">
55
<e-fieldlist-rows>
66
<e-field name="ProductID"></e-field>
77
</e-fieldlist-rows>
@@ -36,41 +36,6 @@
3636
</style>
3737

3838
<script>
39-
40-
var dt = 0;
41-
var data = function (count) {
42-
var result = [];
43-
for (var i = 1; i < (count + 1); i++) {
44-
dt++;
45-
var round = void 0;
46-
var toString_1 = i.toString();
47-
if (toString_1.length === 1) {
48-
round = '0000' + (i);
49-
}
50-
else if (toString_1.length === 2) {
51-
round = '000' + i;
52-
}
53-
else if (toString_1.length === 3) {
54-
round = '00' + i;
55-
}
56-
else if (toString_1.length === 4) {
57-
round = '0' + i;
58-
}
59-
else {
60-
round = toString_1;
61-
}
62-
result.push({
63-
ProductID: 'PRO-' + round,
64-
Year: "FY " + (dt + 2013),
65-
Price: Math.round(Math.random() * 5000) + 5000,
66-
Sold: Math.round(Math.random() * 80) + 10,
67-
});
68-
if (dt / 4 == 1)
69-
dt = 0;
70-
}
71-
return result;
72-
};
73-
7439
var pivotObj; var fieldListObj;
7540
function onGridEnginePopulate(args) {
7641
pivotObj = document.getElementById('PivotView').ej2_instances[0];
@@ -94,6 +59,6 @@
9459
//Generating page settings based on pivot table component’s size.
9560
pivotObj.updatePageSettings(true);
9661
//Assigning page settings to field list component.
97-
fieldListObj.pageSettings =  pivotObj.pageSettings;
62+
fieldListObj.pageSettings = pivotObj.pageSettings;
9863
}
9964
</script>
Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
public ActionResult Index()
22
{
3+
var data = GetPivotData(1000);
4+
ViewBag.DataSource = data;
35
return View();
46
}
57

@@ -9,27 +11,27 @@ public class PivotData
911
public string Year { get; set; }
1012
public double Sold { get; set; }
1113
public double Price { get; set; }
14+
}
1215

13-
public static List<PivotData> GetPivotData(int count)
14-
{
15-
var result = new List<PivotData>();
16-
int dt = 0;
16+
public static List<PivotData> GetPivotData(int count)
17+
{
18+
var result = new List<PivotData>();
19+
int dt = 0;
1720

18-
for (int i = 1; i <= count; i++)
21+
for (int i = 1; i <= count; i++)
22+
{
23+
dt++;
24+
string round = i.ToString().PadLeft(5, '0');
25+
result.Add(new PivotData
1926
{
20-
dt++;
21-
string round = i.ToString().PadLeft(5, '0');
22-
result.Add(new PivotData
23-
{
24-
ProductID = "PRO-" + round,
25-
Year = "FY " + (dt + 2013),
26-
Price = new Random(Guid.NewGuid().GetHashCode()).Next(5000, 10001),
27-
Sold = new Random(Guid.NewGuid().GetHashCode()).Next(10, 91),
28-
});
27+
ProductID = "PRO-" + round,
28+
Year = "FY " + (dt + 2013),
29+
Price = new Random(Guid.NewGuid().GetHashCode()).Next(5000, 10001),
30+
Sold = new Random(Guid.NewGuid().GetHashCode()).Next(10, 91),
31+
});
2932

30-
if (dt / 4 == 1)
31-
dt = 0;
32-
}
33-
return result;
33+
if (dt / 4 == 1)
34+
dt = 0;
3435
}
36+
return result;
3537
}

ej2-asp-core-mvc/code-snippet/pivot-table/getting-start-mvc/field-mapping/tagHelper

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
<e-formatsettings>
44
<e-field name="Amount" format="C0" maximumSignificantDigits="10" minimumSignificantDigits="1" useGrouping="true"></e-field>
55
</e-formatsettings>
6+
<e-fieldmapping>
7+
<e-field name="Quarter" showSortIcon="false"></e-field>
8+
<e-field name="Products" showFilterIcon="false" showRemoveIcon="false"></e-field>
9+
<e-field name="Amount" caption="Sold Amount" showValueTypeIcon="false"></e-field>
10+
</e-fieldmapping>
611
<e-rows>
712
<e-field name="Country" caption="Country"></e-field>
813
</e-rows>
@@ -12,10 +17,5 @@
1217
<e-values>
1318
<e-field name="Sold" caption="Units Sold"></e-field>
1419
</e-values>
15-
<e-fieldmapping>
16-
<e-field name="Quarter" showSortIcon="false"></e-field>
17-
<e-field name="Products" showFilterIcon="false" showRemoveIcon="false"></e-field>
18-
<e-field name="Amount" caption="Sold Amount" showValueTypeIcon="false"></e-field>
19-
</e-fieldmapping>
2020
</e-datasourcesettings>
2121
</ejs-pivotview>

ej2-asp-core-mvc/code-snippet/pivot-table/sorting/custom-sorting/tagHelper

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
<ejs-pivotview id="PivotView" height="300" showGroupingBar="true">
44
<e-datasourcesettings dataSource="@ViewBag.DataSource" expandAll="false">
55
<e-sortsettings>
6-
<e-field name="Country" order="Ascending" membersOrder="@ViewBag.membersOrder"></e-field>
7-
<e-field name="Year" order="Descending" membersOrder="@ViewBag.membersOrder_1"></e-field>
6+
<e-field name="Country" Order="@Sorting.Ascending" membersOrder="@ViewBag.membersOrder"></e-field>
7+
<e-field name="Year" Order="@Sorting.Descending" membersOrder="@ViewBag.membersOrder_1"></e-field>
88
</e-sortsettings>
99
<e-rows>
1010
<e-field name="Country"></e-field>

ej2-asp-core-mvc/code-snippet/pivot-table/sorting/tagHelper

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<ejs-pivotview id="PivotView" height="300">
44
<e-datasourcesettings dataSource="@ViewBag.DataSource" expandAll="false">
55
<e-sortsettings>
6-
<e-field name="Country" order="Descending"></e-field>
6+
<e-field name="Country" Order="@Sorting.Descending"></e-field>
77
</e-sortsettings>
88
<e-rows>
99
<e-field name="Country"></e-field>

0 commit comments

Comments
 (0)