I was able to get the alternating row colors with this code:

$("#dialogTSKComp").autocomplete(
   "xhr/autocomplete_company.cfm", {
     formatItem : function (data, pos, qty) {
       if (pos % 2 == 0) {
         return "<div class=\"ac_odd\">" + data[0] + "</div>";
       }

       return data[0];
     }
   }
);

And then setting up a CSS style for .ac_odd.  But this is adding a DIV 
wrapper for this specific task.  I'd rather just set the class on the 
produced LI tag.  Is there anyway to do that?  Or a better way to 
accomplish this?

Thanks.

Shawn

Shawn wrote:
> I might be a little dense here, but when using Jorn's autocomplete 
> plugin 
> (http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/), I 
> don't see any way to determine/intercept when the hints div has been 
> displayed.  What I'm after is to make the results have alternating row 
> colors.  I have some items that will word-wrap to two or more lines, but 
> there is no clear distinction when this happens.  Anybody have any tips 
> on this?  Will I need to setup something with the formatItem() or 
> formatResult() methods?  I was hoping for something as simple as
> $(".ac_result li:odd").css("background-color", "#ddd");
> But that needs some intercept when the list is finished being populated 
> and rendered.  Or am I making this too difficult?
> 
> Thanks for any tips.
> 
> Shawn
> 

Reply via email to