Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-4641

Datebox doesn't clean beginning and end at client when removing constraint

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: 6.5.8.1, 9.5.0, 9.1.0
    • Fix Version/s: 9.5.1
    • Component/s: Components
    • Security Level: Jimmy
    • gh.sprint.customfield.default.name:
      ZK 9.5.1 S1

      Description

      Steps to Reproduce

      https://zkfiddle.org/sample/5kjfs5/1-Datebox-Constraint-not-cleaning-beginning-and-end

      run fiddle

      Set a constraint using the 2nd button (constraint with between, begining or after)

      remove the constraint with button 3 or 4

      Current Result

      The calendar popup still show disabled dates matching the first constrain, even though the constrain was removed

      Expected Result

      removing the constraint should remove the constraint

      Debug Information

      https://github.com/zkoss/zk/blob/master/zul/src/archive/web/js/zul/db/Calendar.js#L102-L105

      disabled cell checks for calendar beginning and end

      These are not cleaned by _fixConstraint if the constraint is removed

      ex: set here:

      https://github.com/zkoss/zk/blob/master/zul/src/archive/web/js/zul/db/Calendar.js#L571

      not removed after

      Workaround

      <script><![CDATA[ 
              zk.afterLoad("zul.db", function () {
                  var _xCalendar = {};
                  zk.override(zul.db.Calendar.prototype, _xCalendar, {
                      _fixConstraint: function() {
                          var result = _xCalendar._fixConstraint.apply(this, arguments);
                          var constraint = this._constraint || '';
                          if (typeof this._constraint != 'string') return;
                          if( constraint == ''){
                              this._beg = null;
                              this._end = null;
                          }
                          return result;
                      }
                   });
              });
          ]]></script>
      

        Attachments

          Activity

            People

            Assignee:
            Leon03 Leon03
            Reporter:
            MDuchemin MDuchemin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 4 hours
                4h
                Remaining:
                Remaining Estimate - 4 hours
                4h
                Logged:
                Time Spent - Not Specified
                Not Specified