Skip to content

Commit

Permalink
fixed #467
Browse files Browse the repository at this point in the history
  • Loading branch information
Atanas Atanasov committed Dec 6, 2018
1 parent 6711315 commit 1514056
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 56 deletions.
7 changes: 7 additions & 0 deletions Gijgo.GitHub.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,8 @@
<Content Include="examples\grid\Grid.Base.getSelected.sample.html" />
<Content Include="examples\grid\Grid.Base.getSelections.With.Primary.Ket.html" />
<Content Include="examples\grid\Grid.Base.getSelections.Without.Primary.Ket.html" />
<Content Include="examples\grid\Grid.Base.headerRowHeight.AutoGrow.html" />
<Content Include="examples\grid\Grid.Base.headerRowHeight.Fixed.html" />
<Content Include="examples\grid\Grid.Base.hideColumn.sample.html" />
<Content Include="examples\grid\Grid.Base.iconsLibrary.Font.Awesome.html" />
<Content Include="examples\grid\Grid.Base.initialized.sample.html" />
Expand Down Expand Up @@ -416,6 +418,10 @@
<Content Include="examples\grid\Grid.ExpandCollapseRows.icons.collapseRow.Plus.Minus.Icons.html" />
<Content Include="examples\grid\Grid.ExpandCollapseRows.icons.expandRow.Plus.Minus.Icons.html" />
<Content Include="examples\grid\Grid.ExpandCollapseRows.keepExpandedRows.True.html" />
<Content Include="examples\grid\Grid.Export.downloadCSV.Local.Data.html" />
<Content Include="examples\grid\Grid.Export.downloadCSV.Remote.Data.html" />
<Content Include="examples\grid\Grid.Export.getCSV.Local.Data.html" />
<Content Include="examples\grid\Grid.Export.getCSV.Remote.Data.html" />
<Content Include="examples\grid\Grid.FixedHeader.fixedHeader.Bootstrap.3.With.Pager.html" />
<Content Include="examples\grid\Grid.FixedHeader.fixedHeader.Bootstrap.3.Without.Pager.html" />
<Content Include="examples\grid\Grid.FixedHeader.fixedHeader.Bootstrap.4.html" />
Expand Down Expand Up @@ -448,6 +454,7 @@
<Content Include="examples\grid\Grid.InlineEditing.inlineEditing.managementColumn.False.html" />
<Content Include="examples\grid\Grid.InlineEditing.inlineEditing.managementColumn.True.html" />
<Content Include="examples\grid\Grid.InlineEditing.inlineEditing.mode.Command.html" />
<Content Include="examples\grid\Grid.InlineEditing.inlineEditing.mode.DateTime.html" />
<Content Include="examples\grid\Grid.InlineEditing.inlineEditing.mode.Double.Click.html" />
<Content Include="examples\grid\Grid.InlineEditing.rowDataChanged.sample.html" />
<Content Include="examples\grid\Grid.InlineEditing.update.Update.Row.html" />
Expand Down
8 changes: 6 additions & 2 deletions dist/combined/js/gijgo.js
Original file line number Diff line number Diff line change
Expand Up @@ -8690,7 +8690,7 @@ gj.grid.plugins.export = {
if (records.length) {

for (i = 0; i < columns.length; i++) {
if (columns[i].hidden !== true) {
if (gj.grid.plugins.export.public.isColumnApplicable(columns[i])) {
line += '"' + (columns[i].title || columns[i].field).replace(/<[^>]+>/g, ' ') + '",';
}
}
Expand All @@ -8700,7 +8700,7 @@ gj.grid.plugins.export = {
line = '';

for (j = 0; j < columns.length; j++) {
if (columns[j].hidden !== true) {
if (gj.grid.plugins.export.public.isColumnApplicable(columns[j])) {
line += '"' + records[i][columns[j].field] + '",';
}
}
Expand Down Expand Up @@ -8755,6 +8755,10 @@ gj.grid.plugins.export = {
link.click();
document.body.removeChild(link);
return this;
},

isColumnApplicable: function (column) {
return column.hidden !== true && !column.role;
}
},

Expand Down
2 changes: 1 addition & 1 deletion dist/combined/js/gijgo.min.js

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions dist/modular/js/grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -3031,7 +3031,7 @@ gj.grid.plugins.inlineEditing.configure = function ($grid, fullConfig, clientCon
if (records.length) {

for (i = 0; i < columns.length; i++) {
if (columns[i].hidden !== true) {
if (gj.grid.plugins.export.public.isColumnApplicable(columns[i])) {
line += '"' + (columns[i].title || columns[i].field).replace(/<[^>]+>/g, ' ') + '",';
}
}
Expand All @@ -3041,7 +3041,7 @@ gj.grid.plugins.inlineEditing.configure = function ($grid, fullConfig, clientCon
line = '';

for (j = 0; j < columns.length; j++) {
if (columns[j].hidden !== true) {
if (gj.grid.plugins.export.public.isColumnApplicable(columns[j])) {
line += '"' + records[i][columns[j].field] + '",';
}
}
Expand All @@ -3061,6 +3061,10 @@ gj.grid.plugins.inlineEditing.configure = function ($grid, fullConfig, clientCon
link.click();
document.body.removeChild(link);
return this;
},

isColumnApplicable: function (column) {
return column.hidden !== true && !column.role;
}
},

Expand Down
2 changes: 1 addition & 1 deletion dist/modular/js/grid.min.js

Large diffs are not rendered by default.

58 changes: 10 additions & 48 deletions examples/tests/tempgrid.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,55 +51,17 @@
}
</style>
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-xs-12">
<table id="grid"></table>
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function () {
var grid, countries;
grid = $('#grid').grid({
dataSource: '/Players/Get',
uiLibrary: 'bootstrap4',
primaryKey: 'ID',
inlineEditing: { mode: 'command' },
columns: [
{ field: 'ID', width: 44 },
{ field: 'Name', editor: true },
{ field: 'CountryName', title: 'Nationality', type: 'dropdown', editField: 'CountryID', editor: { dataSource: '/Locations/GetCountries', valueField: 'id' } },
{ field: 'DateOfBirth', type: 'date', editor: true },
{ field: 'IsActive', title: 'Active?', type: 'checkbox', editor: true, width: 90, align: 'center' }
],
pager: { limit: 5 }
});
grid.on('rowDataChanged', function (e, id, record) {
// Clone the record in new object where you can format the data to format that is supported by the backend.
var data = $.extend(true, {}, record);
// Format the date to format that is supported by the backend.
data.DateOfBirth = gj.core.parseDate(record.DateOfBirth, 'mm/dd/yyyy').toISOString();
// Post the data to the server
$.ajax({ url: '/Players/Save', data: { record: data }, method: 'POST' })
.fail(function () {
alert('Failed to save.');
});
});
grid.on('rowRemoving', function (e, $row, id, record) {
if (confirm('Are you sure?')) {
$.ajax({ url: '/Players/Delete', data: { id: id }, method: 'POST' })
.done(function () {
grid.reload();
})
.fail(function () {
alert('Failed to delete.');
});
}
});
<body style="padding: 8px;">
<button onclick="grid.downloadCSV('myfilename.csv')" class="gj-button-md">Download CSV</button>
<br /><br />
<table id="grid"></table>
<script>
var grid = $('#grid').grid({
dataSource: '/Players/Get',
uiLibrary: 'materialdesign',
detailTemplate: '<div style="text-align: left"><b>Place Of Birth:</b> {PlaceOfBirth}</div>',
columns: [{ field: 'ID', width: 56 }, { field: 'Name' }, { field: 'DateOfBirth', type: 'date' }]
});
</script>
</body>

</html>
8 changes: 6 additions & 2 deletions src/grid/js/grid.export.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ gj.grid.plugins.export = {
if (records.length) {

for (i = 0; i < columns.length; i++) {
if (columns[i].hidden !== true) {
if (gj.grid.plugins.export.public.isColumnApplicable(columns[i])) {
line += '"' + (columns[i].title || columns[i].field).replace(/<[^>]+>/g, ' ') + '",';
}
}
Expand All @@ -58,7 +58,7 @@ gj.grid.plugins.export = {
line = '';

for (j = 0; j < columns.length; j++) {
if (columns[j].hidden !== true) {
if (gj.grid.plugins.export.public.isColumnApplicable(columns[j])) {
line += '"' + records[i][columns[j].field] + '",';
}
}
Expand Down Expand Up @@ -113,6 +113,10 @@ gj.grid.plugins.export = {
link.click();
document.body.removeChild(link);
return this;
},

isColumnApplicable: function (column) {
return column.hidden !== true && !column.role;
}
},

Expand Down

0 comments on commit 1514056

Please sign in to comment.