bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

Positioning Angular UI bootstrap Datepicker

Open abottoni opened this issue 13 years ago • 64 comments

Hi. As I explained in my case in Stack Overflow (http://stackoverflow.com/questions/18716904/positioning-angular-ui-bootstrap-datepicker) I am having a problem with the positioning in the datepicker. It always appears below the input that invoke it from the bottom left corner. But if the input is close to the right border of the page, the datepicker is cut and a horizontal scroll appears.

I am writing because I think it would be a nice feature to handle the alignment in the datepicker configuration.

Hoping you take this into consideration

Kind Regards Andrey Bottoni

abottoni avatar Sep 16 '13 07:09 abottoni

To temporary solve my issue, I have made a lot of changes. I had to alter the template and remove the left attribute from the inline style. The other thing that I did was encapsulate the input and the datepicker in a Div and using CSS and relative positioning I create a style for the left and right alignment and everywhere I used it, I set the CSS class according the alignment I need. I think it would be easier to have an attribute in the datepicker directive to set the aligment

abottoni avatar Sep 16 '13 07:09 abottoni

Still no solution for this?

terohe avatar Mar 13 '14 11:03 terohe

Unfortunately not. We are trying to come up with a general solution, not just for the datepicker.

bekos avatar Mar 13 '14 11:03 bekos

Ugly hack:

<div class="hackyhack">
  <input datepicker-popup="...">
</div>

Magic CSS:

.hackyhack {
  position: relative;
}
.hackyhack .dropdown-menu {
   left: auto !important;
   right: 0px;
 }

The trick here is that we setting the parent div to be the anchor for all absolutely positioned children (such as .dropdown-menu). This will not work if you set the option to append the date picker to the body. (By default, it appends to the parent node - which is awesome sauce.)

networkerror avatar Mar 27 '14 21:03 networkerror

Hi everybody, I am looking forward when this will get implemented! In the meantime I created a small fix (using angular directives) which currently adds only right alignment, but feel free to contribute! Fix: https://github.com/Martinsos/datepicker-position

Martinsos avatar May 28 '14 20:05 Martinsos

Is there any easy way to pop the datepicker into a modal in order to avoid this issue?

hardywu avatar Jul 08 '14 00:07 hardywu

+1

adressin avatar Jul 09 '14 00:07 adressin

+1

xob avatar Jul 17 '14 11:07 xob

+1

richthedev avatar Jul 17 '14 11:07 richthedev

+1 meanwhile @networkerror's solution did it very nice. ( i had an ugly margin-left -94px)

enapupe avatar Jul 17 '14 18:07 enapupe

+1

maorshabo avatar Jul 22 '14 10:07 maorshabo

+1

pippo3 avatar Jul 22 '14 10:07 pippo3

+1. I needed to put it on top of the textbox, but didn't want to change the template's code. I solved it by using @networkerror's solution:

.input-group {
  position: relative;

  //position it on top of input
  .dropdown-menu {
   top: -245px !important;
  }
}

This has to be changed to top: -285px if you enable the datepicker's button bar. Anyway, for now it works. It would be nice to be able to specify the default position of the datepicker as an attribute.

simonedavico avatar Jul 24 '14 09:07 simonedavico

+1

lincolnge avatar Aug 11 '14 01:08 lincolnge

+1

sasipaants avatar Aug 14 '14 09:08 sasipaants

+1 and customizable left and right icons...

smajl avatar Aug 15 '14 11:08 smajl

+1

ghislainf avatar Aug 15 '14 12:08 ghislainf

Was looking for that option ... so +1

pmaoui avatar Sep 05 '14 20:09 pmaoui

+1

mg1075 avatar Sep 10 '14 00:09 mg1075

+1

natpinit avatar Sep 19 '14 05:09 natpinit