Announcement

Collapse
No announcement yet.

Date picker

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Date picker

    Hi... its me again!

    Can we define a date picker and a entity field were you only choose the year like "2016"?

    Thanks in advance

  • #2
    Hi
    create a view for your field (extends views/fields/date)
    set startDate and endDate options while datepicker init (http://bootstrap-datepicker.readthed...t/options.html)
    Last edited by tanya; 11-04-2016, 10:04 AM.

    Comment


    • #3
      Hi Tanya,

      I read the document you sent, after looking to views/fields/date.js i coudlnt get how it would be usefull.
      I tryed some stuff i googled but i still could get the date picker to show just the year.
      Could give some more hints?

      Thanks in advance

      Comment


      • #4
        for me it works. Overrided afterRender, added to options startDate and endDate (startDate:"01/01/2016" and endDate:"12/31/2016" (format has to be the same as dateFormat option or {+-CntMode})) and clear the browser cache

        Comment


        • #5
          I must have a bug somewere, it doesnt show a date picker just with the years... by options you mean the option in the js or the json ?

          Comment


          • #6
            views/fields/date.js line 150
            Code:
            var options = {
                                format: this.getDateTime().dateFormat.toLowerCase(),
                                weekStart: this.getDateTime().weekStart,
                                autoclose: true,
                                todayHighlight: true,
                                language: language,
                                startDate:"-1m",
                                endDate:"+1",
                            };

            Comment


            • #7
              Hi!
              Much time has passed since last comment of this post. I try to do something like that, but it doesn't work, I see TypeError: this.element.datepicker is not a function in console. My main goal is to disable all previous dated febore current date (e.g. startDate: "0" or new Date())

              PHP Code:
              define('custom:views/fields/date-dynamic-from', ['views/fields/date'], function (Dep) {

              return 
              Dep.extend({
              afterRender: function () {
              Dep.prototype.afterRender.call(this);
              this.$element.datepicker('show');
              }
              });

              });
              ​ 

              Comment

              Working...
              X