Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Date editor shows '00000000' when data is blank #1020

Closed
boehmd1 opened this issue Oct 16, 2018 · 9 comments
Closed

Date editor shows '00000000' when data is blank #1020

boehmd1 opened this issue Oct 16, 2018 · 9 comments
Assignees
Labels
type: bug 🐛 [2] Velocity rating (Fibonacci)

Comments

@boehmd1
Copy link
Contributor

boehmd1 commented Oct 16, 2018

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.

@boehmd1
Copy link
Contributor Author

boehmd1 commented Oct 16, 2018

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

@tmcconechy tmcconechy added this to the Landmark milestone Oct 16, 2018
@tmcconechy tmcconechy added type: bug 🐛 [2] Velocity rating (Fibonacci) labels Oct 16, 2018
@tmcconechy
Copy link
Member

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

@davidcarlsonberg
Copy link
Contributor

@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.

@tmcconechy
Copy link
Member

tmcconechy commented Feb 1, 2019

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' ?

@tmcconechy
Copy link
Member

Also @boehmd1 what was the option in 3.5 called?

@davidcarlsonberg davidcarlsonberg moved this from In progress to To Do in Enterprise 4.16.x (Feb 2019) Sprint Feb 1, 2019
@boehmd1
Copy link
Contributor Author

boehmd1 commented Feb 4, 2019

'loadValue' was a method on the editor.

@boehmd1
Copy link
Contributor Author

boehmd1 commented Feb 4, 2019

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

@tmcconechy
Copy link
Member

@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.

@janahintal
Copy link
Contributor

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

@janahintal janahintal moved this from Ready for QA (beta) to Failed QA (rc) in Enterprise 4.16.x (Feb 2019) Sprint Feb 12, 2019
@janahintal janahintal moved this from Failed QA (rc) to Done in Enterprise 4.16.x (Feb 2019) Sprint Feb 12, 2019
@clepore clepore removed this from the Collaborator: Landmark (deprecated, use labels) milestone Jun 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug 🐛 [2] Velocity rating (Fibonacci)
Projects
No open projects
Development

No branches or pull requests

5 participants