is it possible to Ajaxable CB profile tab?

4 years 8 months ago #313536 by saman2
Replied by saman2 on topic is it possible to Ajaxable CB profile tab?

krileon wrote: Recommend improving your code so it doesn't take forever to execute. Heavy database queries are usually a large reason for slow loading. Beyond that you can try using JS to make an ajax call to your auto action instead of acting on a specific trigger allowing it to be a separate process entirely.

excuse me , i have a mistake in the previous post, i use cb field with Code type not use auto action. my field is execute when loaded in profile.i use some web service to other script (MOODLE) and it is return some data to user profile about some quiz result for user and it is out of my hand to edit that code. according your forge list ajax tab must release almost one month later. is it correct? i can wait for that to next month for that feature.

Please Log in to join the conversation.

4 years 8 months ago #313538 by krileon
Replied by krileon on topic is it possible to Ajaxable CB profile tab?
For what you're doing you'll need an ajax solution then. The proposed feature ticket for tab loading behavior won't help you unless the tab your code field on is on isn't the initially displayed profile tab. I do not have a time frame for the new tab loading behavior. Best I can suggest for now is you'll need to implement your own ajax solution. If all your code field is doing is an HTTP call to Moodle to output whatever the response HTML is then you can replace that entirely with JS ajax call.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

4 years 8 months ago #313539 by saman2
Replied by saman2 on topic is it possible to Ajaxable CB profile tab?

krileon wrote: If all your code field is doing is an HTTP call to Moodle to output whatever the response HTML is then you can replace that entirely with JS ajax call.

it use curl via php to call some webservice and then get the result and do some calculate with php operation on the result the echo that. can you say you mean about JS ? are you mean use Code field type?
2-what is Template in the cb code field in Code tab before codebox? is it benefit for my use? can i use that to implement my curl and calculate on that and use code box only for implement JS with php echo syntax for ajax call to that template?

3- i have an important question about is it possible implement complete doshboard with cb. for example i want implement some chart about user grades with Fusioncharts or some other webservice or other query that maybe is heavy load on page. is CB suitable for this or is Joomla suitable for this? is it better to create separate component for this? (if need seperate topic for this subject say me to create new or move to new topic.)

Please Log in to join the conversation.

4 years 8 months ago #313542 by krileon
Replied by krileon on topic is it possible to Ajaxable CB profile tab?

it use curl via php to call some webservice and then get the result and do some calculate with php operation on the result the echo that. can you say you mean about JS ?

I don't know what all calculations you're doing or what the CURL call requires, but it's likely you can entirely replace it with JavaScript AJAX call. Either using jQuery or just plain JS via XMLHttpRequest.

are you mean use Code field type?

A code field just outputs PHP, but that PHP can be used to echo a script element with all your needed JS or it can use the below API to utilizes jQuery or JS.


jQuery:
global $_CB_framework;

$_CB_framework->outputCbJQuery( 'JQUERY_HERE' );

return '<div class="moodleAjaxRequest"></div>';

JS:
global $_CB_framework;

$_CB_framework->document->addHeadScriptDeclaration( 'JS_HERE' );

return '<div class="moodleAjaxRequest"></div>';

You'd use JavaScript to insert the ajax response to moodleAjaxRequest div for example.

2-what is Template in the cb code field in Code tab before codebox? is it benefit for my use? can i use that to implement my curl and calculate on that and use code box only for implement JS with php echo syntax for ajax call to that template?

Template is used to customize the display of your code. I guess you could have a template that just has your necessary JS for performing the ajax call. That'd be entirely up to you, but it wouldn't be really any different than just putting that JS in the Code parameter.

3- i have an important question about is it possible implement complete doshboard with cb. for example i want implement some chart about user grades with Fusioncharts or some other webservice or other query that maybe is heavy load on page. is CB suitable for this or is Joomla suitable for this? is it better to create separate component for this? (if need seperate topic for this subject say me to create new or move to new topic.)

When using external web services you typically want to load their content in with ajax calls so they don't delay the load of your page. Doesn't really matter what platform you use as using ajax to load those services should always be the case. If you don't and you choose to use cURL then your server will wait until the response is done before it can render the page as that's just how PHP works. How you go about this is entirely up to you. It could be a backend Joomla module you display on Joomlas backend control panel for example.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.221 seconds

Facebook Twitter LinkedIn