set data attributes with ajax and select2
<p>I'm trying setup data attributes into select2 options but without success, at this moment i have the following JS code</p>

<pre><code>_properties.$localElement.select2({
    ajax: {
        url: "url",
        type: "POST",
        dataType: 'json',
        delay: 250,
        data: function (params) {
        return {
            name: params.term, // search term
            type: 1
        };
        },
        processResults: function (data) {

            return {
            results: $.map(data, function (item) {
                return {
                    text: item.name,
                    source: item.source,
                    id: item.id
                }
                })
            };
        },
        cache: true
    },
    //define min input length
    minimumInputLength: 3,

});
</code></pre>

<p>And i want setup a data-source for the selected option value.</p>