show loading message

spsh21 07 Mar, 2017
Hi!

How do I show a 'loading' message when I press Toolbar button? In my connection I have a Toolbar button with Submit option checked and after pressing on this button follows event with PHP function with long processing.


Thanks,
Sergey
Max_admin 07 Mar, 2017
Hi Sergey,

You may use a "Task button" instead and enable the "dynamic ajax features" setting, that will start an AJAX call and will add a loading icon to the button.

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
spsh21 08 Mar, 2017
Hi Max,

Thanks for answer. But I can't unserstand how to fill fields in Dynamic features and Static features of "Task button" settings for my goal. Is there any documentation or an example?

In addition, I need that after pressing this "Task button" the value of selector array gcb[] would be available on server side in PHP script. How can I do this?


Thanks,
Sergey
Max_admin 08 Mar, 2017
Hi Sergey,

If you just want to run an AJAX call then you only need to enable the AJAX option, but if you want to send the gcb values then you need to send the table form as well, this can be done by writing the following code in the "Dynamic task" field:
send:#form_id
the form_id is the same as the table view name, but replace any _ with -

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
spsh21 10 Mar, 2017
Hi Max,

It works, but there is a problem. "Task button" doesn't send submit. And I need submit action for articles list update after php processing. "Toolbar button" sends submit and works fine except showing 'loading message'.

This problem also occurs in your example (custom project "Dynamic actions") when user deletes some article(s), and after successful deletion array gcb may contain already deleted values (if were selected) and the paginator view is not refreshed.

Is it possible to send submit by "Task button" or any other problem decision?

Thanks,
Sergey
Max_admin 10 Mar, 2017
Hi Sergey,

In the custom project, After the article is deleted all the table row is removed, including the selector checkbox, and it will not be available.

Please post the steps you take to generate the problem on the custom project and I will test that.

And the paginator view will not update, this is true but may have a solution in the future.

The other solution would be to add "loading" class to the toolbar button upon clicking it, this requires a small piece of javascript code in a "javascript" view.

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
spsh21 11 Mar, 2017
Hi Max,

About deletion of article:

I add to your custom project "Dynamic actions" a "Toolbar button" with Submit option checked and articles_list in "List view name". This button calls event with PHP function with one string of code:
 print_r($this->data['gcb']); 

After that I save the connection and open it, select all articles, then delete one or more articles and click on my "Toolbar button". After pressing I see all values of gcb including already deleted ones.

In addition to that, your message success:article deleted successfully doesn't appear after deletion, it appears later, after pressing button "Update list" or any other with Submit option.


About "show loading": Could you explain how to do this? In a "javascript" view I have tried to assign function to event on 'click' for the "Toolbar button" and placed this view in "Events" in index event:

$(document).on('click','#upload_files_button',function(event){
alert("You press button");
});


But it doesn't work - nothing happens while clicking the button.


Thanks,
Sergey
Max_admin 11 Mar, 2017
Answer
Hi Sergey,

Thanks for the test steps, I could reproduce the issue, it needs a core code fix though.

You did not need a php function to display the gcb data, just use {debug:} in the event or even {data/pr:gcb}

The code you need may look like this:

jQuery(document).ready(function($){
  $(".special_class").on("click", function(){
    $(this).addClass("loading");
  });
});

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
spsh21 11 Mar, 2017
1 Likes
Hi Max,

Your code works fine. Thanks a lot.



Sorry for my English. It's not my native language.

Thanks,
Sergey
spsh21 12 Mar, 2017
Hi, Max

One more time about article deletion in custom project "Dynamic actions". I have set a trigger on a database table. The trigger checks some conditions and in some cases cancels deletion by this code
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'DELETE canceled'; 


When deletion is canceled your button "article_delete_confirm" changes it's state to "loading" and never disappears.


Thanks,
Sergey
This topic is locked and no more replies can be posted.