Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
base repository: angular-ui/ui-grid
Choose a Base Repository
angular-ui/ui-grid
Aardvark71/ng-grid
AdelinGhanaem/ng-grid
AlasdairSwan/ng-grid
AntonFend/ng-grid
CNXTEoEorg/ui-grid
Dashue/ng-grid
Donderda/ng-grid
EricEngineered/ng-grid
EugeneBorshch/ng-grid
EugeneTruly/ng-grid
GenesysPureConnect/ng-grid
Jammasternam/ng-grid
JavaBasketball/ui-grid
Jenk-Rendar/ng-grid
JonahKE/ui-grid
KNaved/ui-grid
Klarence/ng-grid
Martin17/ng-grid
Mistobaan/ng-grid
Moreface/ng-grid
Pasha-Pramati/ng-grid
Premier/ng-grid
Reskov/ng-grid
SummerDejavu/ng-grid
UrvilKaswala/ng-grid
Wiinis/ng-grid
YonatanKra/ui-grid
a5sk4s/ng-grid
aaks2010/ng-grid
akhileshappala/ui-grid
alecswan/ng-grid
alexspurling/ng-grid
alpinegizmo/ng-grid
anuradha18/ng-grid
archsh/ng-grid
ata-n/ng-grid
avgalon/ng-grid
avikaco/ng-grid
ballmw/ng-grid
bbradbury/ng-grid
benjaminkitt/ng-grid
benmj/ng-grid
blackneus/ng-grid
bmleite/ng-grid
boland/ng-grid
bpoussin/ng-grid
bradlund/ng-grid
bundance/ng-grid
caphun/ng-grid
ccreed2/ui-grid
cdesogeti/ng-grid
ceolter/ui-grid
chanu587/ng-grid
chinnurtb/ng-grid
chiragchamoli/ng-grid
choroshin/ng-grid
christoffee/ng-grid
clkao/ng-grid
cxl55/ng-grid
daclubb/ng-grid
darkhorse-dev/ui-grid
darknos/ng-grid
dcolens/ng-grid
dean-me/ng-grid
demon-lord/ng-grid
devony/ng-grid
doctorsender/ng-grid
ebraminio/ng-grid
ezecafre89/ng-grid
felixhummel/ng-grid
firmusoft/ng-grid
francescoagati/ng-grid
frogomatic/ng-grid
garaboncias/ng-grid
getuliojr/ng-grid
giosakti/ng-grid
goldhand/ng-grid
goodluck2016/ui-grid
hawtio/ng-grid
hey24sheep/ui-grid
hoshidaniel/ng-grid
hotings/ng-grid
hucarrot/ng-grid
imloama/ng-grid
ineedfat/ng-grid
is-fredrik/ng-grid
ismakv/ui-grid
itxd/ui-grid
jeado/ng-grid
jeanpuga/ui-grid
jeffbcross/ng-grid
jeffslofish/ng-grid
jessegavin/ng-grid
jfzman/ng-grid
jharohit/ng-grid
jiacomino/ng-grid
jimhotchkin-wf/ng-grid
jimmytheneutrino/ng-grid
jmaynier/ng-grid
johlrich/ng-grid
johnobe/ng-grid
johnparn/ng-grid
jon23cooper/ng-grid
jozzhart/ng-grid
jspeshu/ng-grid
jstrachan/ng-grid
juliofreitas/ui-grid
jurby/ng-grid
karnyj/ng-grid
keathley/ng-grid
keithharvey/ng-grid
kmussel/ng-grid
koen-serry/ng-grid
konrad-garus/ng-grid
krahman/ng-grid
ksmoore/ng-grid
kugel-soft/ui-grid
lebedevsergey/ui-grid-fix-issue-with-pinned-columns-in-v2
leninloganathan/ui-grid
liergouzi/ui-grid
loiphamvn/ng-grid
longFeiLi/ui-grid
marciosartini/ng-grid
marklagendijk/ng-grid
martijnve/ng-grid
mathiasdose/ng-grid
mathieurivest/ng-grid
matpaprocki/ng-grid
mattlaver/ng-grid
maxcan/ng-grid
mchapman/ng-grid
mediaprojects/ng-grid
mgibson/ng-grid
mheye/ng-grid
mmatczak/ui-grid
mschroering/ng-grid
musically-ut/ng-grid
mxreppy/ng-grid
niilante/ui-grid
nishant8BITS/ng-grid
noming/ng-grid
nuclearghost/ng-grid
orneryd/ng-grid
owenXin/ng-grid
pdegenhardt/ng-grid
pdemanget/ng-grid
ppollono/ng-grid
prabhat2233/ui-grid
presidento/ng-grid
r7lemieux/ng-grid
richiepreece/ng-grid
ronbuchanan/ng-grid
sagarwasule/ng-grid
sapronlee/ng-grid
satyanand/ng-grid
sax1johno/ui-grid
seankenny/ng-grid
simonengelhardt/ng-grid
simplyjames/ng-grid
skusunam/ng-grid
snapappointments/ui-grid
sofibraun/ng-grid
solvebio/ng-grid
songguang-2010/ng-grid
sonicparke/ng-grid
sourcec0de/ng-grid
sravanthipoujula/ng-grid
sskyy/ng-grid
stan-z/ng-grid
strider820/ng-grid
sunfirefox/ng-grid
surfer26th/ng-grid
suryasingh/ng-grid
swalters/ng-grid
tcrimi/ng-grid
tetralon/ng-grid
thedarkjester/ng-grid
tjosbon/ng-grid
tkhemani/ng-grid
tradingscreen/ng-grid
tuckerjt07/ui-grid
turn/ng-grid
uapui-dev/ng-grid
vargose/ng-grid
vladovidiu/ng-grid
wdmny/ng-grid
wp-ng/ui-grid
xordad/ng-grid
xtidt/ui-grid
xtreme-christophe/ng-grid
yangsong158/ui-grid
yanl/ng-grid
yarl/ng-grid
yesnault/ng-grid
yunmanger1/ng-grid
zelingo/ui-grid
zhangdiwaa/ng-grid
zhanghaihua/ng-grid
ztp130213/ng-grid
Nothing to show
base: 201f00d3a16b
head repository: angular-ui/ui-grid
Choose a Head Repository
angular-ui/ui-grid
Aardvark71/ng-grid
AdelinGhanaem/ng-grid
AlasdairSwan/ng-grid
AntonFend/ng-grid
CNXTEoEorg/ui-grid
Dashue/ng-grid
Donderda/ng-grid
EricEngineered/ng-grid
EugeneBorshch/ng-grid
EugeneTruly/ng-grid
GenesysPureConnect/ng-grid
Jammasternam/ng-grid
JavaBasketball/ui-grid
Jenk-Rendar/ng-grid
JonahKE/ui-grid
KNaved/ui-grid
Klarence/ng-grid
Martin17/ng-grid
Mistobaan/ng-grid
Moreface/ng-grid
Pasha-Pramati/ng-grid
Premier/ng-grid
Reskov/ng-grid
SummerDejavu/ng-grid
UrvilKaswala/ng-grid
Wiinis/ng-grid
YonatanKra/ui-grid
a5sk4s/ng-grid
aaks2010/ng-grid
akhileshappala/ui-grid
alecswan/ng-grid
alexspurling/ng-grid
alpinegizmo/ng-grid
anuradha18/ng-grid
archsh/ng-grid
ata-n/ng-grid
avgalon/ng-grid
avikaco/ng-grid
ballmw/ng-grid
bbradbury/ng-grid
benjaminkitt/ng-grid
benmj/ng-grid
blackneus/ng-grid
bmleite/ng-grid
boland/ng-grid
bpoussin/ng-grid
bradlund/ng-grid
bundance/ng-grid
caphun/ng-grid
ccreed2/ui-grid
cdesogeti/ng-grid
ceolter/ui-grid
chanu587/ng-grid
chinnurtb/ng-grid
chiragchamoli/ng-grid
choroshin/ng-grid
christoffee/ng-grid
clkao/ng-grid
cxl55/ng-grid
daclubb/ng-grid
darkhorse-dev/ui-grid
darknos/ng-grid
dcolens/ng-grid
dean-me/ng-grid
demon-lord/ng-grid
devony/ng-grid
doctorsender/ng-grid
ebraminio/ng-grid
ezecafre89/ng-grid
felixhummel/ng-grid
firmusoft/ng-grid
francescoagati/ng-grid
frogomatic/ng-grid
garaboncias/ng-grid
getuliojr/ng-grid
giosakti/ng-grid
goldhand/ng-grid
goodluck2016/ui-grid
hawtio/ng-grid
hey24sheep/ui-grid
hoshidaniel/ng-grid
hotings/ng-grid
hucarrot/ng-grid
imloama/ng-grid
ineedfat/ng-grid
is-fredrik/ng-grid
ismakv/ui-grid
itxd/ui-grid
jeado/ng-grid
jeanpuga/ui-grid
jeffbcross/ng-grid
jeffslofish/ng-grid
jessegavin/ng-grid
jfzman/ng-grid
jharohit/ng-grid
jiacomino/ng-grid
jimhotchkin-wf/ng-grid
jimmytheneutrino/ng-grid
jmaynier/ng-grid
johlrich/ng-grid
johnobe/ng-grid
johnparn/ng-grid
jon23cooper/ng-grid
jozzhart/ng-grid
jspeshu/ng-grid
jstrachan/ng-grid
juliofreitas/ui-grid
jurby/ng-grid
karnyj/ng-grid
keathley/ng-grid
keithharvey/ng-grid
kmussel/ng-grid
koen-serry/ng-grid
konrad-garus/ng-grid
krahman/ng-grid
ksmoore/ng-grid
kugel-soft/ui-grid
lebedevsergey/ui-grid-fix-issue-with-pinned-columns-in-v2
leninloganathan/ui-grid
liergouzi/ui-grid
loiphamvn/ng-grid
longFeiLi/ui-grid
marciosartini/ng-grid
marklagendijk/ng-grid
martijnve/ng-grid
mathiasdose/ng-grid
mathieurivest/ng-grid
matpaprocki/ng-grid
mattlaver/ng-grid
maxcan/ng-grid
mchapman/ng-grid
mediaprojects/ng-grid
mgibson/ng-grid
mheye/ng-grid
mmatczak/ui-grid
mschroering/ng-grid
musically-ut/ng-grid
mxreppy/ng-grid
niilante/ui-grid
nishant8BITS/ng-grid
noming/ng-grid
nuclearghost/ng-grid
orneryd/ng-grid
owenXin/ng-grid
pdegenhardt/ng-grid
pdemanget/ng-grid
ppollono/ng-grid
prabhat2233/ui-grid
presidento/ng-grid
r7lemieux/ng-grid
richiepreece/ng-grid
ronbuchanan/ng-grid
sagarwasule/ng-grid
sapronlee/ng-grid
satyanand/ng-grid
sax1johno/ui-grid
seankenny/ng-grid
simonengelhardt/ng-grid
simplyjames/ng-grid
skusunam/ng-grid
snapappointments/ui-grid
sofibraun/ng-grid
solvebio/ng-grid
songguang-2010/ng-grid
sonicparke/ng-grid
sourcec0de/ng-grid
sravanthipoujula/ng-grid
sskyy/ng-grid
stan-z/ng-grid
strider820/ng-grid
sunfirefox/ng-grid
surfer26th/ng-grid
suryasingh/ng-grid
swalters/ng-grid
tcrimi/ng-grid
tetralon/ng-grid
thedarkjester/ng-grid
tjosbon/ng-grid
tkhemani/ng-grid
tradingscreen/ng-grid
tuckerjt07/ui-grid
turn/ng-grid
uapui-dev/ng-grid
vargose/ng-grid
vladovidiu/ng-grid
wdmny/ng-grid
wp-ng/ui-grid
xordad/ng-grid
xtidt/ui-grid
xtreme-christophe/ng-grid
yangsong158/ui-grid
yanl/ng-grid
yarl/ng-grid
yesnault/ng-grid
yunmanger1/ng-grid
zelingo/ui-grid
zhangdiwaa/ng-grid
zhanghaihua/ng-grid
ztp130213/ng-grid
Nothing to show
compare: 7d24b69280fa
  • 2 commits
  • 7 files changed
  • 1 commit comment
  • 2 contributors
Commits on Dec 20, 2014
Fix #1572 (saveState): create saveState feature
@@ -0,0 +1,118 @@
@ngdoc overview
@name Tutorial: 208 Saving and restoring the state of the grid
@description The save state feature allows you to save the current look of the grid
and restore it upon returning to the grid.

For example, you may have an application where your user can reorder the columns,
adjust column widths, apply sorts and filters, and select a specific cell. The user
might adjust their grid to look as they wish, and then navigate to another page. When
the user returns to the page with the grid, they might expect it to look like it
did when they left. The save state feature permits this.

There are two core methods:

- save, which packages the current grid state into an object which the calling application
then stores somewhere (a cookie, session state, a database)
- restore, which takes a grid state object, and returns the grid to the state that
is stored in that object

Note that the saveState functionality deliberately sets out to store the transient state -
the information that isn't held in gridOptions nor columnDefs. The calling application is responsible for
storing gridOptions and columnDefs (and must have had them in order to render the grid the first time).

The feature also provides some options that control what is saved. All options are true by
default:

- saveWidths
- saveOrder
- saveScroll
- saveFocus
- saveVisible
- saveSort
- saveFilter

@example
In this example we provide a button to save the grid state. You can then modify the grid layout
to something different, and use the restore button to set the grid back the way it was.


<example module="app">
<file name="app.js">
var app = angular.module('app', ['ngAnimate', 'ngTouch', 'ui.grid', 'ui.grid.saveState', 'ui.grid.selection', 'ui.grid.cellNav', 'ui.grid.resizeColumns', 'ui.grid.moveColumns' ]);

app.controller('MainCtrl', ['$scope', '$http', '$interval', function ($scope, $http, $interval) {
$scope.gridOptions = {
saveFocus: false,
saveScroll: true,
enableFiltering: true,
onRegisterApi: function(gridApi){
$scope.gridApi = gridApi;
}
};
$scope.state = {};

$scope.saveState = function() {
$scope.state = $scope.gridApi.saveState.save();
};

$scope.restoreState = function() {
$scope.gridApi.saveState.restore( $scope, $scope.state );
};

$http.get('/data/100.json')
.success(function(data) {
$scope.gridOptions.data = data;
});
}]);
</file>

<file name="index.html">
<div ng-controller="MainCtrl">
<div id="grid1" ui-grid="gridOptions" ui-grid-save-state ui-grid-selection ui-grid-cellNav ui-grid-resize-columns ui-grid-move-columns class="grid"></div>
<button id="save" type="button" class="btn btn-success" ng-click="saveState()">Save</button>
<button id="restore" type="button" class="btn btn-success" ng-click="restoreState()">Restore</button>
</div>
</file>

<file name="main.css">
.grid {
width: 500px;
height: 400px;
}
</file>
<file name="scenario.js">
var gridTestUtils = require('../../test/e2e/gridTestUtils.spec.js');
describe( '208 save state', function() {
it('Set a sort and a filter, save state, hide a column and remove sort and filter, set another sort and filter, restore the state', function () {
gridTestUtils.expectHeaderColumnCount( 'grid1', 3 );

gridTestUtils.expectHeaderCellValueMatch( 'grid1', 0, 'Name' );
gridTestUtils.expectHeaderCellValueMatch( 'grid1', 1, 'Gender' );
gridTestUtils.expectHeaderCellValueMatch( 'grid1', 2, 'Company' );
gridTestUtils.expectCellValueMatch( 'grid1', 0, 0, 'Ethel Price' );

gridTestUtils.clickColumnMenuSortAsc( 'grid1', 2 );
gridTestUtils.enterFilterInColumn( 'grid1', 1, 'female' );
gridTestUtils.expectCellValueMatch( 'grid1', 0, 0, 'Freda Mason' );

element(by.id('save')).click();

gridTestUtils.clickColumnMenuRemoveSort( 'grid1', 2 );
gridTestUtils.cancelFilterInColumn( 'grid1', 1 );
gridTestUtils.expectCellValueMatch( 'grid1', 0, 0, 'Ethel Price' );

gridTestUtils.clickColumnMenuSortAsc( 'grid1', 0 );
gridTestUtils.enterFilterInColumn( 'grid1', 2, 'Gee' );
gridTestUtils.clickColumnMenuHide( 'grid1', 1 );
gridTestUtils.expectCellValueMatch( 'grid1', 0, 0, 'Alexander Foley' );
gridTestUtils.expectHeaderColumnCount( 'grid1', 2 );

element(by.id('restore')).click();

gridTestUtils.expectHeaderColumnCount( 'grid1', 3 );
gridTestUtils.expectCellValueMatch( 'grid1', 0, 0, 'Freda Mason' );
});

});
</file>
</example>
@@ -208,13 +208,11 @@
* @name scrollTo
* @methodOf ui.grid.cellNav.api:PublicApi
* @description brings the specified row and column into view
* @param {Grid} grid the grid you'd like to act upon, usually available
* from gridApi.grid
* @param {object} $scope a scope we can broadcast events from
* @param {object} rowEntity gridOptions.data[] array instance to make visible
* @param {object} colDef to make visible
*/
scrollTo: function (grid, $scope, rowEntity, colDef) {
scrollTo: function ($scope, rowEntity, colDef) {
service.scrollTo(grid, $scope, rowEntity, colDef);
},

@@ -224,13 +222,11 @@
* @methodOf ui.grid.cellNav.api:PublicApi
* @description brings the specified row and column into view, and sets focus
* to that cell
* @param {Grid} grid the grid you'd like to act upon, usually available
* from gridApi.grid
* @param {object} $scope a scope we can broadcast events from
* @param {object} rowEntity gridOptions.data[] array instance to make visible and set focus
* @param {object} colDef to make visible and set focus
*/
scrollToFocus: function (grid, $scope, rowEntity, colDef) {
scrollToFocus: function ($scope, rowEntity, colDef) {
service.scrollToFocus(grid, $scope, rowEntity, colDef);
},

@@ -350,11 +346,11 @@
scrollTo: function (grid, $scope, rowEntity, colDef) {
var gridRow = null, gridCol = null;

if (rowEntity !== null) {
if (rowEntity !== null && typeof(rowEntity) !== 'undefined' ) {
gridRow = grid.getRow(rowEntity);
}

if (colDef !== null) {
if (colDef !== null && typeof(colDef) !== 'undefined' ) {
gridCol = grid.getColumn(colDef.name ? colDef.name : colDef.field);
}
this.scrollToInternal(grid, $scope, gridRow, gridCol);
@@ -158,7 +158,7 @@
* @ngdoc object
* @name ui.grid.exporter.api:GridOptions
*
* @description GridOptions for selection feature, these are available to be
* @description GridOptions for exporter feature, these are available to be
* set using the ui-grid {@link ui.grid.class:GridOptions gridOptions}
*/
/**

Showing you all comments on commits in this comparison.

@deadmann

This comment has been minimized.

Copy link

deadmann commented on 55e50d8 Jun 1, 2015

First thing, i'm not sure if i get the git right,
But, ...
if this is last file, which i already build a sample over it, and test it, it's not going to be enough...

there should be these two option... otherwise saving this content is nonsense

  1. Save Data To Cookie, and re-loadable ability (should be checked if the new grid columns are changed (due update of older system, so wont result in failure))
  2. Ability to transfer state object to the remote server, and to do save it in DB / Or remote cookie. (BTW if this one exist then it's lack of my knowledge to translate java object to ASP Objects...)

And may i notified if it fixed: mimosh_pisholack@hotmail.com

You can’t perform that action at this time.