I have some problems, which implement the feature of jQuery with auto-complete categories and custom display.
I'm saying the error 'ui.item' is undefined when I select one entry on my code below
$ jq.widget ("custom. Categoryautocomplete ", $ jq.ui.autocomplete, {_renderMenu: function (ul, item) {var self = this; var currentCategory =" "; $ Jq.each (item, function (index, item) {if (item.category ! = CurrentCategory) {ul.append ("li class = 'ui-autocomplete-category' & gt;" + item category + ""); currentCategory = item.category;} Self._renderItem (ul, item);});}}); Focus: function (event, UI) {$ jq ("# tlf \\: tlfs") {$ jq ("function: ) .val (ui.item.label); Return Return;}, Select: Function (Event, UI) {$ jq ("# tlf \\: tlfs"). Val (""); // JavaScript code Select the line to select (ui.item.rownum); Return return;}}.) Data ("Category AutoComplete") ._RenderItem = function (ul, item) {return $ jq ("& lt; li & Gt; "). Data (" item.categoryautocomplete ", item) .append (" & lt; a & gt; "+ item.type +" - "+ item.uid +" & Lt; br & gt; "+ item.desc +" & lt; / a & gt; ") .appendTo (UL);};}); When I start typing, I'm able to see the list drop down, so I think my JSON is well-formed. Any ideas that may cause 'ui.item undefined' error?
Edit: After further investigation it works when I remove the custom_renderItem method I'm not sure why this problem is causing.
OK I found out my problem I did not know
< Code> .data ("item.categoryautocomplete", item) After reading it, I read it
.data ("item. Autocomplete ", item) and everything looks fine.
Comments
Post a Comment