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

Decimalbox can paste content copy from excel cell

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Normal
    • 9.0.1
    • 8.6.1
    • Components
    • Security Level: Jimmy
    • None
    • ZK 9.0.1 S1

    Description

      Description

      on excel you have cell with decimal value.
      when choose cell and copy, on clipboard we have string like (with a line break)
      "12.3
      "
      so can't paste to Decimalbox, need trim before paste

      a version before i can do it.

       

      Workaround

          <script><![CDATA[  
          zk.afterLoad("zul.inp", function () {
              var _xInputWidget = {};
              zk.override(zul.inp.InputWidget.prototype, _xInputWidget, {
                  _shallIgnore: function (evt, keys) {
                      if (evt.keyCode || evt.charCode) {
                      // ZK-1736 add metakey on mac
                          if (zk.mac && evt.metaKey)
                              return;
                          else {
                              var code = (zk.ie < 11 || zk.opera) ? evt.keyCode : evt.charCode;
                              if (!evt.altKey && !evt.ctrlKey && _keyIgnorable(code)
                              && keys.indexOf(String.fromCharCode(code)) < 0) {
                                  evt.stop();
                                  return true;
                              }
                          }
                      } else {
                          var orgEvtText = evt.domEvent.originalEvent.clipboardData.getData('text'),
                              text = (orgEvtText) ? orgEvtText : window.clipboardData.getData('text'),
                          text = text.trim();
                          keys = keys.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
                          var regKey = '^[' + keys + ']+$';
                          if (!new RegExp(regKey).test(text)) {
                              evt.stop();
                              return true;
                          }
                      }
                  },
                  _updateValue: function (pasteEvent) {
                      //Support maxlength for Textarea
                      if (this.isMultiline()) {
                          var maxlen = this._maxlength;
                          if (maxlen > 0) {
                              var inp = this.getInputNode(),
                                  clipboardEvent = pasteEvent ? pasteEvent.domEvent.originalEvent : null,
                                  val = clipboardEvent ? clipboardEvent.clipboardData.getData('text') : inp.value;
                                  val = val.trim();
                              if (val != this._defRawVal && val.length > maxlen) {
                                  inp.value = val.substring(0, maxlen);
                                  if (pasteEvent)
                                      pasteEvent.stop();
                              }
                          }
                      }
                      this._startOnChanging();
                  }
               });
          });
          ]]></script>
      

       

      Attachments

        Issue Links

          Activity

            People

              DevChu DevChu
              hiepgau hiepgau
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: