After some experiment, I managed to solve this problem. 

The key is to update the _dirty status in the onSelect event of datepicker. 
A modification would be:

1. Copy the implementation of DateFieldView to a custom javascript module

2. add onSelect handler in the render method:

    render: function () {
        RB.ReviewRequestFields.TextFieldView.prototype.render.call(this);

        // editor handle
        var inline_editor = this.inlineEditorView;

        this.inlineEditorView.$field.datepicker({
                changeMonth: true,
                changeYear: true,
                dateFormat: $.datepicker.ISO_8601,
                showButtonPanel: true,
                onSelect: function(dateText, instance) {
                    if (dateText != instance.lastVal) {
                        inline_editor._dirty = true;
                    }
                },
            });

        return this;
    },

I wonder if this should be the default behavior of BaseDateField?


MZZ
2018/05/02
Meng-Zhe Zhang於 2018年4月28日星期六 UTC+8下午6時24分53秒寫道:
>
> Hi. I tried to use the BaseDateField class to add a custom field in the 
> review request page.
>
> By following the example code in the document, the field shows up as 
> expected. If the date string was manually typed in, it worked ok, just like 
> other built-in fields.
>
> However, when the date was picked using datepicker, no "publish" button 
> shows up, and the picked date was not saved.
>
> Is it because a custom FieldView is also required? Or due to other reasons?
>
> Thanks for answering.
>
> MZZ
> 2018/04/28
>
>

-- 
Supercharge your Review Board with Power Pack: 
https://www.reviewboard.org/powerpack/
Want us to host Review Board for you? Check out RBCommons: 
https://rbcommons.com/
Happy user? Let us know! https://www.reviewboard.org/users/
--- 
You received this message because you are subscribed to the Google Groups 
"Review Board Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to reviewboard+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to