开发者

Dont know how to sort results in autocomplete jquery!

Aloha! I use autocomplete jquery plugin to suggest input on the page, suggest search on array with string elements. I use this settings for autocomplete:

$("#colorsearch").autocomplete(data, {
        matchContains: true,
        autoFill:false});
    }); 

So...when i start input what i`m looking for, for example 'dave' the results are: 'ravedave', 'sadave','dave' (because it have the same order in data array) and so on....i need that first elements of result li开发者_如何学编程st have substring ('dave') at the beginning, like this: 'dave' etc... I used sort function with custom sorting functions. But it work only outside autocomplete. I need do this inside this plugin. Who knows?


There is a variable called sortResults injquery complete and it is true by defaults.So you need to set that variable .

$('#txtserach').autocomplete({url:"default.aspx", sortResults: false})
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜