Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Datepicker - Tweak yearpicker layout by defining max years per row #3348

Closed
rvanbaalen opened this issue Feb 27, 2015 · 5 comments
Closed

Datepicker - Tweak yearpicker layout by defining max years per row #3348

rvanbaalen opened this issue Feb 27, 2015 · 5 comments

Comments

@rvanbaalen
Copy link
Contributor

This is a feature request / proposal (I'll create a PR if you guys can enlighten me on some points).

Right now we have the yearRange property in the datepicker-options attribute / default options object.
By tweaking that value, the maximum number of years shown in the 'yearpicker' is adjusted.

By default, the yearRange is set to 20 and a max number of years per row is hardcoded to 5.
This creates a nice 5x4 grid of years in the yearpicker view.

When ajusting the yearRange setting, the max number of years is still hardcoded to 5. For example in my use case I wanted a smaller yearpicker and set the value to 9. The result was as follows:

screen shot 2015-02-27 at 15 42 40

To change this, I want to be able to adjust the maximum number of years per row to 3 to create a nice and neat 3x3 grid like this (dont mind the styling):

screen shot 2015-02-27 at 15 53 22

Now my proposition was to implement a new config key: yearsPerRow
Using that key you can, as one might expect, adjust the number of years per row to your needs.

Another solution would be to deprecate yearRange and introduce something similar to yearGrid and accept a string value like year range X years per row. In the example situation above I would have this in my datepicker-options config object:

{
    yearGrid: '9x3'
}

But then again describing a grid like that can be confusing (one could expect a result of 9 years in a row, 3 rows high).

So what do you think? Go for yearsPerRow seems like the fastest and clearest solution.

@karianna
Copy link
Contributor

I think yearsPerRow is a reasonable step.

@rvanbaalen
Copy link
Contributor Author

I'm working on the yearsPerRow implementation.

I have the actual feature implemented but only need to make the layout more dynamic now since the table header is hardcoded to a colspan of three columns.

@karianna Are you the only one actively maintaining this repo / replying to issues? I see that there are more owners / contributors but don't see that many responding on new issues.

@rvanbaalen
Copy link
Contributor Author

Could also implement the yearGrid option like this:

{
    yearGrid: '3x3'
}

And use the result of the sum to set the total years and the first part of the sum to set the yearsPerRow. That way, it's much more intuitive to use.

@karianna
Copy link
Contributor

karianna commented Mar 4, 2015

I'm in charge of triaging at present - we'll start going through PR's tomorrow night - it's going to take time to clear the whole backlog first, angular 1.3 compatibility is the next goal.

@rvanbaalen
Copy link
Contributor Author

Yeah I've seen that backlog indeed. It's freakin' huge. I suppose 9 out of 10 PR's are out of date by now unfortunately.

I don't know if you already have some sort of way of doing things but if you for example could comment on each PR that you want tested and add specific test cases that you want to be checked, I and other interested community members could help out testing those PR's.

@rvanbaalen rvanbaalen self-assigned this Mar 6, 2015
davious added a commit to davious/angular-ui-bootstrap that referenced this issue Nov 27, 2015
BREAKING CHANGE: yearRange is replaced by yearRows and yearColumns
fixes angular-ui#3348
davious added a commit to davious/angular-ui-bootstrap that referenced this issue Dec 13, 2015
BREAKING CHANGE: yearRange is replaced by yearRows and yearColumns
fixes angular-ui#3348
@wesleycho wesleycho added this to the 1.0.0 milestone Dec 14, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.