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

时间:2016-03-16 19:17:47

标签: w2ui

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

1 个答案:

答案 0 :(得分:1)

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

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

{ 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以获取“官方”回复。