twitter/bootstrap — pull request #5310 by loostro (2012-09-27 08:44:24+00:00)
Title: Getter/setter methods for object data-source

BC break: no
Feature: yes
Documentation: in PR description

Setter method allows to customize what is set as `data-value`.

Previously the script would break if item was an object, becouse render method rendered `
`.

This method allows you to specify which field should be used as identifier for your result (preferabely database entry ID, but it can be any unique field).

Getter method allows to customize how item is retrieved from data source.

Previously the script just passed `item` (which was sufficient for simple string).

This method is connected to setter method. If you set `data-value` as `item.id` then the getter method must look for `item.id == pk` (where pk is value of `data-value` passed to this function). Returns the object matching that identiefier.

Example on JSFiddle:

http://jsfiddle.net/ZAQ2S/12/

Update: rebaseing against w-i-p branch.