开发者

Extjs combo as autocomplete search box, synchronization

开发者 https://www.devze.com 2023-04-12 02:50 出处:网络
I have a problem which I use as autocomplete search. The issue is that when I write something, and I make mistake then delete last开发者_C百科 char, There are two requests. Sometimes the second reques

I have a problem which I use as autocomplete search. The issue is that when I write something, and I make mistake then delete last开发者_C百科 char, There are two requests. Sometimes the second request comes back first and the store loads results and then the first request comes back and store is populated with that result set. So I end in a situation where I have word_two in searchbox, and results for word_one.

Is there a way to tell store to abort previous request when new one is fired? Or at least tell the store to wait for the request to come back before starting new one?


Ok. I've done it like this and it works. I added proxy to store:

proxy: new Ext.data.HttpProxy({
    url: 'some_url',
        listeners:{
            beforeload:{
                scope:this,
                fn:function(dp, params){
                    if(dp.activeRequest['read']){
                        dp.activeRequest['read'].conn.abort();
                    }
                }
            }
        },
0

精彩评论

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

关注公众号