【问题标题】:Dropdown below text field in SuiteCRMSuiteCRM 中文本字段下方的下拉菜单
【发布时间】:2019-06-13 15:37:52
【问题描述】:

在我输入任务模块的文本字段时,我希望在下方显示(可选)预测的下拉列表。我知道如何从数据库值更改下拉字段的下拉值,但用户无法在下拉字段中输入新值(只能选择)。我希望用户能够像往常一样在文本字段中输入条目,并在下面输入文本的可点击建议,如下拉菜单。我是 SuiteCRM 的新手,所以文件路径会很有帮助。

【问题讨论】:

    标签: user-interface drop-down-menu sugarcrm suitecrm


    【解决方案1】:

    请使用 select2 javascript 插件。 以PFB为例,

    $("#field_name").select2({
        placeholder: 'Select a data',
        allowClear: true,
        minimumInputLength: 3,
        tags: [],
        ajax: {
            url: '<your url>',
            dataType: 'json',
            type: "GET",
            quietMillis: 1000,
            delay: 900,
            data: function (term) {
                return {
                    data:$('#field_name').val(),    
                };
            },
            beforeSend: function() {
                $('#ajaxloading_c').css('visibility', 'visible'); 
                $('#ajaxloading_c').css('display', 'block');
                $('#ajaxloading_mask').css('display', 'block'); 
            },
            results: function (data) {
                return {
                    results: $.map(data, function (item) {
                        return {
                            text: item.name,
                            id: item.id 
                        }
                    })
                };
                $('#select2-field_name-results li').first().remove();
            },
            complete: function() {
                $('#ajaxloading_c').css('visibility', 'hidden');
                $('#ajaxloading_c').css('display', 'none');
                $('#ajaxloading_mask').css('display', 'none');  
                $('#select2-field_name-results li').first().remove();
                if($('#select2-field_name-results li:first').text() == 'No data Found'){
                    $("#select2-field_name-results li:first").css("pointer-events", "none");
                }
            }
        }
    });
    $('.select2-container--focus, .select2-container--default').css('width','70%');
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-01-02
      • 2021-05-25
      • 2013-08-20
      • 2013-06-18
      • 1970-01-01
      • 2016-06-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多