Download the PHP package level51/silverstripe-ajax-select-field without Composer

On this page you can find all versions of the php package level51/silverstripe-ajax-select-field. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package silverstripe-ajax-select-field

SilverStripe Ajax Select Field

This module adds a AjaxSelectField and a AjaxMultiSelectField to select results returned from an ajax endpoint.

Result Fetching

Results can be fetched from a custom endpoint (using the setEndpoint(ENDPOINT_URL) method) or using a callback function passed in to the field using setSearchCallback (see example below).

The response has to be a JSON array with an object per result, where each result has to have at least an id and title field, so for example:

Storage

Single Select (AjaxSelectField)

By default the whole result (with all it's properties) will be stored in the DB as JSON string, although there is also an "id only" mode.

So the DB value will look like { "id": "1", "title": "Home" } with idOnlyMode = false. With the mode activated only the id will be stored (as with the default DropdownField).

Multi Select (AjaxMultiSelectField)

The results will be stored as JSON array containing the IDs of the selected items, so e.g. ["1", "2"].

Methods / Options

setEndpoint(string)

Set a custom search endpoint by passing the whole url.

setSearchCallback(callable)

Pass a callback function executed on each search request. Uses the search method defined in the field class.

setMinSearchChars(int)

Change the amount of characters required for searches to be executed (defaults to 3).

setPlaceholder(string)

Change the default placeholder text of the input field.

setGetVars(array)

Set a list of custom GET vars which should be added to each request. Have to be in format ["key" => "value"].

setSearchHeaders(array)

Set a list of custom request headers sent with each search request. Have to be in format ["key" => "value"].

setIdOnlyMode(bool) [only single select]

En-/disable the idOnlyMode. If active the field will only store the "id" of the selected result. Otherwise the full result payload will be stored.

Note that the search endpoint or callback has to support requests with a ?id param returning only that one result if the mode is active.

setDisplayFields(array) [only multi select]

Define the list of fields to display for selected items, so basically the table columns. Defaults to id and title.

enableSorting / disableSorting [only multi select]

En-/disable the ability to sort the selected items by their display fields.

Installation

composer require level51/silverstripe-ajax-select-field

Usage Example

Single Select

Multi Select

Requirements

Maintainer


All versions of silverstripe-ajax-select-field with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
ext-json Version *
silverstripe/framework Version ^4.0 || ^5.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package level51/silverstripe-ajax-select-field contains the following files

Loading the files please wait ....