harvesthq/chosen — pull request #1264 by gitlost (2013-06-06 14:29:49+00:00)
Title: Add results_data_callback function option

New option "results_data_callback" to specify a function to be invoked
after select parsing that can manipulate the results data parsed from
the select.

The function takes two arguments, the results_data and root, and returns
the results_data:

function results_data_callback(results_data, root) {
return results_data;
}

This allows one to (for instance) add html markup to the data, which
can be useful if one wants to stylise the options in some way.

In order to make the option useful for html injection, setting the
select_item changes to use (in jquery, already the case in prototype)
html rather than text. Also the winnow_results function changes to cater
for possible html markup.