Skip to content
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
967fd7f
Initial checkin of export to excel. No examples or unit tests
Mar 13, 2017
4a83641
Eliminate $$hashKey and uidPrefix = 'uiGrid' from export
Mar 13, 2017
90b19ed
Sheet name cannot be empty string or it causes export errors. Default…
Apr 17, 2017
a05b872
Additional languages
May 5, 2017
1de5abc
Add documentation
May 5, 2017
42ba195
fix syntax causing lint errors. Check if not a tree when exporting to…
May 5, 2017
485a743
Updated example with colors
May 5, 2017
a838090
Merge branch 'master' into excel_export
monster910 May 5, 2017
129ba55
Merge branch 'master' into excel_export
monster910 May 22, 2017
14b89db
Update unit tests and fix the lodash version for import to remove amb…
monster910 Jun 7, 2017
6edb646
Update comments
monster910 Nov 12, 2017
a7ae180
Fix menu under strict mode from throwing error
monster910 Dec 18, 2017
159a70c
Updated directions for npm and add more formatting examples
monster910 Dec 18, 2017
0344ae6
Merge branch 'master' into excel_export
monster910 Dec 18, 2017
3076df2
Fix test cases for excel export that was a merge error
monster910 Dec 18, 2017
f898f62
docs(410_excel_exporting_data_and_header.ngdoc): Update with sum colu…
monster910 Jan 30, 2018
b1de005
fix(exporter): Fix bug where selection column width was included
monster910 Jan 30, 2018
bc4fcbd
docs(410_excel_exporting*.ngdoc): Add date column and example with ex…
monster910 Jan 30, 2018
4d4e8f0
docs(410_excel_exporting*.ngdoc): Fix for native excel 2017. No 'type'
monster910 Jan 30, 2018
bfa2c17
Resolving merge conflict
mportuga Feb 2, 2018
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 34 additions & 3 deletions misc/tutorial/410_excel_exporting_data_and_header.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,35 @@ In this example we use the native grid menu buttons, and we show the pdf, csv an

$scope.formatters = {};

$scope.randomDate = function randomDate(start, end) {
var diff = end.getTime() - start.getTime();
var new_diff = diff * Math.random();
var date = new Date(start.getTime() + new_diff);
return date;
};

$scope.gridOptions = {
columnDefs: [
{ field: 'name' },
{ field: 'gender', visible: false},
{ field: 'company' },
{ field: 'member' },
{ field: 'total' }
{ field: 'total' },
{ field: 'updatedDate', displayName: 'Date', cellFilter: 'date:\'yyyy-MM-dd\'', width: 150,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do these updates have to do with the bug that you are trying to fix?

sortingAlgorithm: function (aDate, bDate) {
var a=new Date(aDate);
var b=new Date(bDate);
if (a < b) {
return -1;
}
else if (a > b) {
return 1;
}
else {
return 0;
}
}
}
],
enableGridMenu: true,
enableSelectAll: true,
Expand Down Expand Up @@ -96,6 +118,8 @@ In this example we use the native grid menu buttons, and we show the pdf, csv an
var formatter = stylesheet.createFormat(aFormatDefn);
// save the formatter
$scope.formatters['bold'] = formatter;
var dateFormatter = stylesheet.createSimpleFormatter('date');
$scope.formatters['date'] = dateFormatter;

aFormatDefn = {
"font": stdStyle.id,
Expand Down Expand Up @@ -136,16 +160,21 @@ In this example we use the native grid menu buttons, and we show the pdf, csv an
// set metadata on export data to set format id. See exportExcelHeader config above for example of creating
// a formatter and obtaining the id
var formatterId = null;
if (cellValue && typeof cellValue === 'string' && cellValue.startsWith('W')) {
if (gridCol.field === 'name' && cellValue && cellValue.startsWith('W')) {
formatterId = $scope.formatters['red'].id;
}

if (gridCol.field === 'updatedDate') {
formatterId = $scope.formatters['date'].id;
}

if (formatterId) {
return {metadata: {style: formatterId}};
} else {
return null;
}
},
},
exporterFieldApplyFilters: true,
onRegisterApi: function(gridApi){
$scope.gridApi = gridApi;
}
Expand All @@ -158,9 +187,11 @@ In this example we use the native grid menu buttons, and we show the pdf, csv an
for (var i=0; i < data.length; i++) {
data[i].member = false;
data[i].total = i + 0.1;
data[i].updatedDate = $scope.randomDate(new Date('09-11-2008'), new Date());
}
$scope.gridOptions.data = data;
});

}]);
</file>

Expand Down