Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update select.blade.php #2110

Open
wants to merge 1 commit into
base: 2.0
Choose a base branch
from
Open

Update select.blade.php #2110

wants to merge 1 commit into from

Conversation

dahaha-365
Copy link

添加钩子,使开发者能给指定的select控件进行个性化配置

例如:在grid方法中注入代码:

admin_inject_section('admin.select-ajax.pk_project', "console.log(configs);configs = $.extend(configs, {escapeMarkup: function(e){return e}, templateSelection: function(t){return void 0!==t.description?t.text+'  <span class=\"text-gray\">'+t.description+'</span>':t.text}})");

在页面上能在实例化之前随意配置config变量:

(function () {var configs = {"allowClear":true,"placeholder":{"id":"","text":"\u9009\u62e9"}};

        
    console.log(configs);configs = $.extend(configs, {escapeMarkup: function(e){return e}, templateSelection: function(t){return void 0!==t.description?t.text+'  <span class="text-gray">'+t.description+'':t.text}})

        $.ajax({"url":"http:\/\/127.0.0.1:8000\/admin\/fdc\/api\/project\/get_projects"}).done(function(data) {
        $(".pk_project").select2($.extend(configs, {
            data: data,
        })).val([]).trigger("change");
    });
})();;

添加钩子,使开发者能给特定的select控件进行个性化处理
Copy link

stale bot commented Sep 11, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant