{"id":19367556,"url":"https://github.com/infinityloop-dev/ajaxselect","last_synced_at":"2026-03-03T03:06:00.549Z","repository":{"id":57025183,"uuid":"165432925","full_name":"infinityloop-dev/ajaxselect","owner":"infinityloop-dev","description":":wrench: Ajax-filled select box for Nette forms.","archived":false,"fork":false,"pushed_at":"2022-12-02T20:29:33.000Z","size":38,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-02T16:50:28.317Z","etag":null,"topics":["ajax","ajaxselect","form","nette","php"],"latest_commit_sha":null,"homepage":"https://www.infinityloop.dev","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/infinityloop-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-12T20:29:02.000Z","updated_at":"2022-12-02T19:17:13.000Z","dependencies_parsed_at":"2023-01-22T23:00:23.979Z","dependency_job_id":null,"html_url":"https://github.com/infinityloop-dev/ajaxselect","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/infinityloop-dev%2Fajaxselect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/infinityloop-dev%2Fajaxselect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/infinityloop-dev%2Fajaxselect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/infinityloop-dev%2Fajaxselect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/infinityloop-dev","download_url":"https://codeload.github.com/infinityloop-dev/ajaxselect/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250451811,"owners_count":21432906,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ajax","ajaxselect","form","nette","php"],"created_at":"2024-11-10T08:03:25.417Z","updated_at":"2026-03-03T03:06:00.494Z","avatar_url":"https://github.com/infinityloop-dev.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ajaxselect\n:wrench: Ajax-filled selectbox for nette forms.\n\n![Packagist](https://img.shields.io/packagist/dt/nepttune/ajaxselect.svg)\n![Packagist](https://img.shields.io/packagist/v/nepttune/ajaxselect.svg)\n[![CommitsSinceTag](https://img.shields.io/github/commits-since/nepttune/ajaxselect/v1.0.svg?maxAge=600)]()\n\n[![Code Climate](https://codeclimate.com/github/nepttune/ajaxselect/badges/gpa.svg)](https://codeclimate.com/github/nepttune/ajaxselect)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/nepttune/ajaxselect/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/nepttune/ajaxselect/?branch=master)\n\n## Introduction\n\nThis extension provides easy to use ajax-driven selectbox.\n\n## Dependencies\n\n- [nepttune/base-requirements](https://github.com/nepttune/base-requirements)\n\n## How to use\n\n- Register `\\Nepttune\\DI\\AjaxSelectExtension` as nette extension.\n- Use `addAjaxSelect` or `addAjaxMultiSelect` in your forms.\n\n### Example configuration\n\n```\nextensions:\n    ajaxSelect: Nepttune\\DI\\AjaxSelectExtension\n```\n\n### Example form\n\n```php\n$form-\u003eaddAjaxSelect('client_id', 'Klient', function (string $query, ?int $default = 0) {\n      if ($default) {\n          $row = $this-\u003erepository-\u003egetRow($default);\n          return [$row-\u003eid =\u003e $row-\u003ename];\n      }\n\n      return $this-\u003erepository-\u003esearch($query);\n  })\n  -\u003esetPrompt('--- Vyberte ---')\n  -\u003esetRequired();\n```\n\nParameter `$query` contains text being searched, parametered `$default` contains value which is set as default (for example when  editing existing entry, you need to provide saved key =\u003e value in your callback).\n\n### Javascript snippet using select2\n```js\nif ($(this).data('ajaxselect')) {\n    $(this).select2({\n        tokenSeparators: [',', ' '],\n        ajax: {\n            url: $(this).data('ajaxselect'),\n            delay: 250,\n            dataType: 'json',\n            data: function (params) {\n                return {\n                    q: params.term\n                };\n            },\n            processResults: function (data, params) {\n                var result = [];\n                $.each(data, function (key, value) {\n                    result.push({\n                        id: key,\n                        text: value\n                    });\n                });\n                return {\n                    results: result\n                };\n            }\n        }\n    });\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finfinityloop-dev%2Fajaxselect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finfinityloop-dev%2Fajaxselect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finfinityloop-dev%2Fajaxselect/lists"}