是否可以在 w2ui 工具栏中输入日期

Is it possible to have a date input in a w2ui toolbar

我想知道是否有任何方法可以将日期输入控件放置在类似于表单上用于日期输入的工具栏中?

是的,这是可能的,但它很古怪。

您必须将输入字段定义为工具栏按钮:

{ type: 'html',   id: 'roles', html: '<input id="id_role">' },

并且在工具栏的 onRefresh() 事件中,您必须将输入转换为所需的 w2filed:

        onRefresh: function(event) {
            if(event.target == 'roles'){
                // w2field in toolbar must be initialized during refresh
                // see: https://github.com/vitmalina/w2ui/issues/886
                event.onComplete = function(ev){
                    $("#id_role").w2field('list', { items: roles });
                };
            }
        },

在我的示例中,我插入了一个下拉列表,但您可以根据需要进行调整。

请参阅 https://github.com/vitmalina/w2ui/issues/886 以获得 "official" 回复。