1

My extension places a field on a page that loads data via AJAX from the database. The field appears blank until the data is loaded. How can I show the CiviCRM spinning logo if my data isn't loaded yet?

1

You can add the class "crm-loading-element" to the element, and then in your ajax success handler remove the class.

If you want the actual CiviCRM logo, you can add both the classes "blockUI blockOverlay" instead, but depending on the field size it may look off. The other one seems to fit better.

If you want the screen to gray out the way some of the popups do, you can do:

CRM.$.blockUI(CRM.$('div.something').addClass('blockUI').addClass('blockOverlay'));

where div.something is just some larger div surrounding your form, but somewhere within div#crm-container, then your ajax success handler remove it with:

CRM.$.unblockUI(CRM.$('div.something').removeClass('blockUI').removeClass('blockOverlay'));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.