Jump to content

Fix/Workaround to manage custom fields loading time


32Bit

Recommended Posts

Having added a custom fields based dropdown for the location (Country/Region/City) into Jreviews I was uncomfortable with how long it was taking to load each fields data via Ajax.

 

When selecting a category a spinner appears while the the new data is fetched however this isn't implemented for custom fields.

 

I've gone through the code and figured out what changes to make to add this functionality. It's just two additions:

 

In jreviews.fields.js (around line 570) beneath the following:

if((cachedResp == null && sel_val != '' && sel_val != null)) {    

Add this:

jQuery('#'+fname).parent().append('<span class="jr_loadingSmall"></span>'); 

 

Then several lines below line 570 there's the following line:

 

'onComplete':function(valResp){

Add this:

jQuery('#'+fname).siblings('.jr_loadingSmall').remove();						

 

It would be great if this change (or something similar) could be incorporated into Jreviews.

 

 

Also, looking at the POST date that is returned i noticed that there appears to be a fair amount of text being transferred for each entry.

 

Loads of entrys like this:

 

{"optionid":"342734","text":"Brighton","value":"U23","image":"","ordering":"0"}

 

We sometimes have ~100 entries that can take up to 5 seconds to download but we're not using the Image or Ordering options.

 

It's just a thought but perhaps in situations where certain parameters aren't used the data could be shortened to this:

 

{"oid":"342734","text":"Brighton","value":"U23"}

 

 

Thanks

 

Link to comment
  • 3 months later...
×
×
  • Create New...