0

I have a Dojo FilteringSelect that takes about 20 seconds to load its values from the dB when the user clicks the arrow in the list box. I'd like to display a progress spinner while waiting for the data to be returned from the dB. Any ideas what event I would use to show my spinner when the data is being retrieved from the db and what event to hide the spinner when it completes? Thanks...

new FilteringSelect({
    store: new dojo.data.ItemFileReadStore({ url: "some url here" }),
    autocomplete: true,
    maxHeight: "300",
    required: false,
    id: "country_select_id",
    onChange: function(data) {
        dojo.byId("case_info_status").innerHTML = " ";
    }
}, "country_select_id"); 
4

1 に答える 1

0

select._fetchHandle deferred と store._fetchItems. これを試して

var select = new .... Your FilteringSelect Construct( {} );

select._fetchHandle.addCallback(function() {
 // success callback
 dojo.style(dojo.byId('spinner'), "display", "none");

});

dojo.connect(select.store._fetchItems, function() {
   if(select.store._loadFinished) return; // no-op
   dojo.style(dojo.byId('spinner'), "display", "block");
});

編集:

select._fetchHandle は、実際のダウンロード中に短時間だけ存在します (select onOpen が呼び出された後にフックできるとします)。代わりに、ItemFileReadStore の別のプライベート メソッドが便利です

dojo.connect(select.store._getItemsFromLoadedData, function() {
     dojo.style(dojo.byId('spinner'), "display", "none");
});
于 2012-08-23T12:47:44.413 に答える