From 9f18685cb2545745428a352a8d9b498e5fe2b1c2 Mon Sep 17 00:00:00 2001 From: Daniel Pollock Date: Tue, 12 Nov 2013 12:40:23 -0600 Subject: [PATCH] verbiage describe how to use id property with ajax calls. In reference to issue #852 --- index.html | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/index.html b/index.html index 334ec5c0..9619af90 100644 --- a/index.html +++ b/index.html @@ -558,6 +558,12 @@ $("#e19").select2({ maximumSelectionSize: 3 });

Example Code


               

Select2 uses jQuery's $.ajax function to execute the remote call by default. An alternative transport function can be specified in the ajax settings, or an entirely custom implementation can be built by providing a custom query function instead of using the ajax helper.

+

Select2 requires an id property to be set for items returned in the results parameter. If your result doesn't have an 'id' property then you can specify it in the id parameter of select2. For example: + + id: function(object) { + return object.text; + } will use the text property as the id. +