Created by: ioleo
BC break: no Feature: yes Documentation: yes
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 <li data-value="[object Object]">
.
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:
Update: rebaseing against w-i-p branch.