Enterprise: Date editor shows '00000000' when data is blank

Created on 16 Oct 2018  ·  9Comments  ·  Source: infor-design/enterprise

Describe the bug
When the dataGrid makes a cell editable, if there is no cellText it fetches the field value. The field value in our application has zeros for blank date values. The date editor opens with zeros.

Below is the code that is being referenced.

    makeCellEditable: function(row, cell, event) {

      if (!this.isCellEditable(row, cell)) {
        return;
      }

      //Locate the Editor
      var col = this.columnSettings(cell);
      if (!col.editor) {
        if (event.keyCode === 32) {
          this.toggleRowSelection(this.activeCell.node.closest('tr'));
        }
        return;
      }

      // Put the Cell into Focus Mode
      this.setActiveCell(row, cell);

      var cellNode = this.activeCell.node.find('.datagrid-cell-wrapper'),
        cellParent = cellNode.parent('td'),
        cellValue = (cellNode.text() ? cellNode.text() : this.fieldValue(this.settings.dataset[row], col.field));

      if (cellParent.hasClass('is-editing')) {
        //Already in edit mode
        //Editor.focus
        cellNode.find('input').focus();
        return false;
      }

To Reproduce
Steps to reproduce the behavior:

  1. Edit datagrid/example-editable so that the date or orderdate is '00000000'
  2. open http://localhost:4000/components/datagrid/example-editable

Expected behavior
Expect if there is no cell text then either an empty string is passed or the field value is formatted.

[2] type

All 9 comments

FYI: 3.5 controls provided callback that allowed for the field value to be changed before using the value in the editor.

I think the 0000000 seems like a Locale conversion bug.
But in addition to that , the call back is a nice idea as it would allow for future customization

@boehmd1 Could you please provide steps to replicate this issue? The "To Reproduce" section in the Issue Description has not been updated/changed. Thanks kindly.

Good call - i thought i reproduced this but im not sure what the data would actually be set to. If i try this example: http://localhost:4000/components/datagrid/example-editable.html then there is some blank data that is rendering ok without the 0000000 in the grid. Is the data example like: string '00000000' ?

Also @boehmd1 what was the option in 3.5 called?

'loadValue' was a method on the editor.

To reproduce...
Use the example http://localhost:4000/components/datagrid/example-editable
Change the date or OrderDate '00000000'

@davidcarlsonberg loadData was a hook on the editor. We probably can make Locale format 00000000 correctly to an empty date to solve this. Then if we want a hook in the editors we can do that in addition.

QA Passed. Moving t Done.
Tested in: http://localhost:4000/components/datagrid/example-editable in all Devices, Browsers ans OS.

Was this page helpful?
0 / 5 - 0 ratings