Uploaded image for project: 'ZK Spreadsheet'
  1. ZK Spreadsheet
  2. ZSS-1328

ZSS percentage edition changes value of cell if rounded

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • 3.9.2
    • 3.9.1
    • ZSS Component Client
    • Security Level: Jimmy
    • None

      Steps to Reproduce

      Open attached book1.xlsx in zss
      The value of E3 cell is 0.015, formatted as percentage, rounded with 0 decimals
      It's display result is 2%
      double click on the cell to edit it

      Current Result

      edit mode display "2%"
      Leaving the cell will save "0.02" as value

      Expected Result

      edit mode should display "1.5%"
      leaving the cell without editing its value should not loose rounding precision

      Debug Info

      Text / value switch happen in zss.DataPanel.prototype._openEditbox

      Root Cause

      Workaround

      	<script><![CDATA[
      		zk.afterLoad('zss', function() {
      			var xDataPanel = {};
      			zk.override(zss.DataPanel.prototype, xDataPanel ,{
      				_openEditbox: function(d, g) {
      	                var b = this.sheet
      	                  , a = b.getFocusedCell();
      	                if (a != null) {
      	                    if (b.state == zss.SSheetCtrl.START_EDIT) {
      	                        var c = b.inlineEditor
      	                          , f = b.getLastFocus()
      	                          , e = !d && d != "" ? b.isPercentCell(a.r, a.c) ? (parseFloat(a.edit)*100)+"%" : a.edit : d;
      	                        c.edit(a.comp, f.row, f.column, e ? e : "", g);
      	                        b.state = zss.SSheetCtrl.EDITING
      	                    }
      	                }
      	            }
      			});//zk.override
      		});//zk.afterLoad
      	]]></script>
      

            henrichen henrichen
            MDuchemin MDuchemin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: