Forums › Forums › OroCRM › OroCRM – Programming Questions › Datagrid inline edit date – allow empty
This topic contains 13 replies, has 3 voices, and was last updated by Dawid 6 years ago.
Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.
- CreatorTopic
- April 23, 2018 at 3:03 am #25558
Hey,
any idea how to make possible to clear date from inline edit?
My entity have date field, nullable=true.
On datagrid when I edit and clear any existing date, cannot save empty value. With overrided validation rules, still nothing:YAML123456dateTest:label: Datefrontend_type: dateinline_editing:validation_rules:NotBlank: falsedate-editor-view.js looks ok, cannot localize problem, any help will be appreciate.
Steps to reproduce:
1. create grid with date field, and inline edit on,
2. setup any date,
3. try to set empty field – impossible - CreatorTopic
- AuthorReplies
- April 23, 2018 at 4:00 am #25559
Hi,
it’s not a valid configuration
NotBlank: false
Validation cannot be overridden in symfony, the only way to change it – changing validation groups.April 23, 2018 at 4:12 am #25560Its not a valid here, because doesn`t work :)
But this is the right way to pass validator to inline edit js scripts right?
Can you be more specific about validation groups?- This reply was modified 6 years ago by
Dawid.
April 23, 2018 at 4:29 am #25562Is this your custom datagrid or you are trying to extend the built-in?
April 23, 2018 at 4:38 am #25563It is my custom. Column is based on entity, that have field:
PHP12345678<?php/**** @var \DateTime** @ORM\Column(name="date_agreed", type="date", nullable=true)*/protected $dateAgreed;Datagrid is simple, no validation asserts on entity.
And column on datagrid is defined simple like that:YAML123dateAgreement:label: My labelfrontend_type: dateInline edit works fine, but cannot put empty value. Maybe date validator do it?
April 23, 2018 at 4:41 am #25564then just remove NotBlank: false from config, as it’s not needed.
April 23, 2018 at 4:42 am #25565And don’t worry about validation groups, I guess you want to override validation, but for new rules it’s not relevant.
April 23, 2018 at 4:43 am #25566Yes I know, I just tryied to override not blank validator like that, based on default configuration specified inside date-editor-view.js:
JavaScript12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364/** @lends DateEditorView */define(function(require) {'use strict';/*** Date cell content editor** ### Column configuration samples:* <code></code>` yml* datagrids:* {grid-uid}:* inline_editing:* enable: true* # <grid configuration> goes here* columns:* # Sample 1. Mapped by frontend type* {column-name-1}:* frontend_type: date* # Sample 2. Full configuration* {column-name-2}:* inline_editing:* editor:* view: oroform/js/app/views/editor/date-editor-view* view_options:* css_class_name: '<class-name>'* datePickerOptions:* altFormat: 'yy-mm-dd'* changeMonth: true* changeYear: true* yearRange: '-80:+1'* showButtonPanel: true* validation_rules:* NotBlank: true* save_api_accessor:* route: '<route>'* query_parameter_names:* - '<parameter1>'* - '<parameter2>'* <code></code>`** ### Options in yml:** Column option name | Description* :---------------------------------------------------|:-----------* inline_editing.editor.view_options.css_class_name | Optional. Additional css class name for editor view DOM el* inline_editing.editor.view_options.dateInputAttrs | Optional. Attributes for the date HTML input element* inline_editing.editor.view_options.datePickerOptions| Optional. See [documentation here](http://api.jqueryui.com/datepicker/)* inline_editing.validation_rules | Optional. Validation rules. See [documentation](../reference/js_validation.md#conformity-server-side-validations-to-client-once)* inline_editing.save_api_accessor | Optional. Sets accessor module, route, parameters etc.** ### Constructor parameters** @class* @param {Object} options - Options container* @param {Object} options.model - Current row model* @param {string} options.fieldName - Field name to edit in model* @param {Object} options.validationRules - Validation rules. See [documentation here](../reference/js_validation.md#conformity-server-side-validations-to-client-once)* @param {Object} options.dateInputAttrs - Attributes for date HTML input element* @param {Object} options.datePickerOptions - See [documentation here](http://api.jqueryui.com/datepicker/)* @param {string} options.value - initial value of edited field** @augments [TextEditorView](./text-editor-view.md)* @exports DateEditorView*/Its not working, so sure I will remove it. But why I cannot clear date value inside my field? When you setup any date, cannot be cleared.
April 23, 2018 at 4:50 am #25567For a test I just created column in my datagrid:
YAML123456dateAgreement:label: Date fieldfrontend_type: dateinline_editing:editor:view: oroform/js/app/views/editor/text-editor-viewAnd with text editor its clear that required validator is on, there was a message. But why? Is default for date field?
- This reply was modified 6 years ago by
Dawid.
April 23, 2018 at 5:45 am #25569Problem is also when I edit date on any form. Field is not required but empty value is not saved. Oro date field create fake date field and dont pass value if empty to original one
April 23, 2018 at 6:08 am #25570–
- This reply was modified 6 years ago by
Andrey Yatsenko.
April 23, 2018 at 6:08 am #25572Hello @dawid.kamola,
It looks like a bug of DateTimePickerView. What version of Oro do you use?
In latest version DateTimeEditor works fine. Could you confirm that similar to your case works here https://demo.orocrm.com/desktop/task ?April 23, 2018 at 6:12 am #25573Hi, thank you for this answer! I have 2.5.0 and cannot set empty task date. But here I see it works, so it was fixed on 2.6? Or maybe on 3.0, I see is 3.0 beta there
- This reply was modified 6 years ago by
Dawid.
April 23, 2018 at 6:33 am #25575Ok for anyone with same problem, I see it was fixed in 2.6:
https://github.com/oroinc/platform/tree/2.6/src/Oro/Bundle/UIBundle/Resources/public/js/app/views/datepickerBAP-16591: Not able to clear the value in Date field (#16811)
Thanks Hryhorii!
- This reply was modified 6 years ago by
- AuthorReplies
The forum ‘OroCRM – Programming Questions’ is closed to new topics and replies.