aurelia-v-grid / vGrid

Aurelia-v-grid - npm source
MIT License
49 stars 10 forks source link

save/restore column visbility and order #58

Closed Thanood closed 7 years ago

Thanood commented 7 years ago

Is it somehow possible to restore a certain order of columns? Let's say I let the user move columns around. I want my app to save this new order so that the user sees the same order he "left" with when he opens the app next time.

For this I would need to read the column order, save it somewhere (localStorage f.i.) and then set it again when loading the app.

vegarringdal commented 7 years ago

Think we should be able to do something like that. I havent added the option to create column setup with binding a configuration, but that and a way to get the current setup would fix it. Could be useful to just have a get and set function for this, so you could have multiple option not just duing load, sometimes when working with data your column setup really depends on what you are doing at that moment

Thanood commented 7 years ago

Could be useful to just have a get and set function for this,

Perfect! 👍

vegarringdal commented 7 years ago

If you clone repo you can check a early version of this, in the long run this will need some work, but something to work on.

PS! row-repeat wont work with this this.. ( I think... maybe it does, really dont know)

vegarringdal commented 7 years ago

image

just select this navigation, edit the column setup and click saveColConfig, then go to the first and back again, it should remember the column setup

Thanood commented 7 years ago

Wow, you're fast. 👍 I will clone it tomorrow, anyway.

row-repeat wont work with this this..

With row-repeat have literally full control anyway, right? :smiley:

vegarringdal commented 7 years ago

yes.

but pinned columns might work at the same time, if it does Im not sure if I should call it feature or bug :joy:

vegarringdal commented 7 years ago

u trying to use the grid with real data will prb help a lot seeing missing parts, stuff that needs to improve, esp on the datasource, and prb gridconnector too. thats the 2 of 3 replacable part (that I want to be replaceable ) selection is the 3 :-) just need to get them 100% for local array before creating interfaces.

vegarringdal commented 7 years ago

Added a set function too, since you missed that a lot :-)

Thanood commented 7 years ago

Thank you so much! :smiley:

vegarringdal commented 7 years ago

fixed this so if you set null it restores grid to default column set in html (this will not work with the html row-repeat)

vegarringdal commented 7 years ago

Sum up this:

Get:

let columnConfigArray = this.gridConnector.getColConfig();

Set

this.gridConnector.getColConfig(columnConfigArray);

Set default

this.gridConnector.getColConfig(null);
Thanood commented 7 years ago

Nice, thanks! :+1: Would it be possible to, for example read the columns, set the column templates to null, then set the columns so order etc. is restored but only the col templates are taken from default?

vegarringdal commented 7 years ago

this.gridConnector.getColConfig(null) restores default set in the html, even if you havent read any columns first, or did I just misunderstand where you where headed with this? :-)

Thanood commented 7 years ago

Yes. :smiley: In short: I want to save all column parameters but I'd like to be able to reset only the template. I thought the best way to do it is this.gridConnector.setColConfig(config) with a config that has all templates set to null. config itself is not null.

vegarringdal commented 7 years ago

but I'd like to be able to reset only the template

Not sure if Im following you here, if you dont have custom html making you columns, you can clear out the colRowTemplate & colheaderTemplate, that will be rebuild. If you have custom html making you column then you cant, since thats what Im putting inside in the columns in the rows. I could maybe try and split these later, making it easier to know whats generated by grid, and whats generated by you.

vegarringdal commented 7 years ago

Adding this should solve this ? Give better control over it atleast https://github.com/vegarringdal/vGrid/issues/68

vegarringdal commented 7 years ago

this should be solved, just reopen if I missed something