Uploaded image for project: 'Keikai'
  1. Keikai
  2. KEIKAI-750

cell text not updated before server-side formatting, causes incorrect formatting after KEIKAI-470

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 6.1.0
    • None
    • None
    • None

      Steps to Reproduce

      1. Open a blank document in Keikai
      2. Right click on cell A1
      3. Select formatCell > Custom > "#,##0_);[Red](#,##0)"
      4. Click OK
      5. In cell A1, enter value 1.1, then press Enter
      6. In cell A1, enter value 1.2, then press Enter

      Current Result

      Cell is correctly formatted as "1" after first edit
      Cell is incorrectly formatted as "1.2" after 2nd edit

      Expected Result

      Cell is formatted as "1" in both cases

      Debug Information

      zss.Cell.prototype.setText checks for cell this.text value and compare with new value before setting.
      this.text is the same formatted text (1.1 formats to 1, 1.2 formats to 1), so setText returns without updating the cell, since the value of this.text is already "1", even though the actual cell text from getText() is 1.2

      Workaround

      	<script><![CDATA[
      		zk.afterLoad("zss", function () {
      		    var _xCell = {};
      		    zk.override(zss.Cell.prototype, _xCell, {
      		    	setText: function (newText) {
      		            if (!newText)
      		                newText = "";
      		            if (newText == this.text && newText == this.getText()) { // KEIKAI-168
      		                return;
      		            }
      		            this._setText(newText);
      		    	}
      		     });
      		});
      	]]></script>
      

            jumperchen jumperchen
            MDuchemin MDuchemin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: