1
0
mirror of synced 2024-11-22 21:16:10 +03:00

add reference to original option element in the data when attached to select. fixes #171

This commit is contained in:
Igor Vaynberg 2012-06-28 23:50:36 -07:00
parent 504bca4b43
commit 6b736669d2

View File

@ -626,10 +626,10 @@
var group; var group;
if (element.is("option")) { if (element.is("option")) {
if (query.matcher(term, element.text())) { if (query.matcher(term, element.text())) {
collection.push({id:element.attr("value"), text:element.text()}); collection.push({id:element.attr("value"), text:element.text(), element: element.get()});
} }
} else if (element.is("optgroup")) { } else if (element.is("optgroup")) {
group={text:element.attr("label"), children:[]}; group={text:element.attr("label"), children:[], element: element.get()};
element.children().each2(function(i, elm) { process(elm, group.children); }); element.children().each2(function(i, elm) { process(elm, group.children); });
if (group.children.length>0) { if (group.children.length>0) {
collection.push(group); collection.push(group);