小编mar*_*kle的帖子

select2 - initselection错误

使用select2插件时出现以下错误initSelection.

Error: Uncaught Error: No select2/compat/initSelection 是我得到的错误.

希望有人帮我inistselection解决问题.

JS:

  $(".doctor_id_pat").select2({
    placeholder: "Search Users",
    minimumInputLength: 2,
    ajax: {
        url: "/listallergiesajax",
        dataType: 'json',
        data: function(term) {
            return {
                q: term
            };
        },
        results: function(data, page) {
            return {

                results: $.map(data, function(item) {

                    return {
                        text: item.text,
                        id: item.id
                    }
                })

            };
        },
    },
    initSelection: function(element, callback) {

        $.ajax("/listallergiesajax", {
            dataType: "json"
        }).done(function(data) {

            callback(data.results[0]);

        });
    }
});
Run Code Online (Sandbox Code Playgroud)

jquery jquery-select2

7
推荐指数
1
解决办法
1万
查看次数

zend框架2 - 在两个不同的模块中使用相同的路由名称的问题

我试图为2个不同的模块使用相同的路由名称,是否可能?

模块用户:

 /*Module.config.php*/

 'dashboard' => array(
                'type'    => 'segment',
                'options' => array(
                    'route'    => '/dashboard',
                    'constraints' => array(
                        'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
                    ),
                    'defaults' => array(
                        'controller' => 'Users\Controller\Users',
                        'action'     => 'dashboard',
                    ),
                ),
 ),
Run Code Online (Sandbox Code Playgroud)

模块管理员:

/*Module.config.php*/ 

'dashboard' => array(
                'type'    => 'segment',
                'options' => array(
                    'route'    => '/dashboard',
                    'constraints' => array(
                        'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
                    ),
                    'defaults' => array(
                        'controller' => 'Admin\Controller\Admin',
                        'action'     => 'dashboard',
                    ),
                ),
  ),
Run Code Online (Sandbox Code Playgroud)

虽然我正在为仪表板创建2个不同的模块,但我只加载任何一个动作.

我怎样才能做到这一点?

php zend-route zend-router zend-framework2

1
推荐指数
1
解决办法
561
查看次数

0
推荐指数
1
解决办法
85
查看次数