How to auto reload List in Content Plugin

sunnyjey

Active Member
The following code in list_X.js automatically reloads the list.

Code:
requirejs(['fab/fabrik'],function(){
   Fabrik.addEvent('fabrik.list.loaded', function(list) {
      list.updateRows.periodical(10000, list);
   });
});

But, this doesn't work in List displayed through the Content Plugin. Is there any way to auto reload list in content plugin every nth time interval ?
 
Does that work?

Code:
function updateList26() {
Fabrik.blocks.list_26_mod_fabrik_list_91.submit();
}
var interval = setInterval(updateList26, 10000);

Of course change the list number to match your list.
 
Thank you. Truly appreciated.

It is working BUT chrome console is giving following error:

Code:
list_8.js:8 Uncaught TypeError: Cannot read property 'submit' of undefined
    at updateList8 (list_8.js:8)

This is my code:

Code:
function updateList8() {
    Fabrik.blocks.list_8_mod_fabrik_list_8.submit();
}
var interval = setInterval(updateList8, 10000);

So every 10 sec Chrome js console flashes this error. Any idea how to resolve this error ?
 
Inspect your page source.
I assume it needs the id in the fabrikDataContainer which is like
list_125_com_content_125
if loaded via content plugin

(list_26_mod_fabrik_list_91 is for list 26 displayed in Fabrik list module 91)
 
Inspect your page source.
I assume it needs the id in the fabrikDataContainer which is like
list_125_com_content_125
if loaded via content plugin

I've modified code as per your suggestion, But same error. Chrome console is displaying following error every 10 sec.

Screenshot 2020-09-25 at 4.42.56 PM.png

Following is modified code for content plugin. Not sure, but it looks we have to add 'Fabrik.addEvent' trigger NOT 'Submit'.

Screenshot 2020-09-25 at 4.36.46 PM.png
 
Just checked in more detail in a list where I have another list in the list outro with content plugin. The following code works without any errors:

Code:
requirejs(['fab/fabrik'], function() {

function updateList119() {
Fabrik.blocks.list_184_com_fabrik_184.submit();
}
var interval = setInterval(updateList119, 5000);
});

In addition to inspecting the source, you can check the fabrik block names when typing "Fabrik.blocks" in the browser console. In my case it was "list_184_com_fabrik_184"
 
I just tested with a list (id 125) via content plugin (J! article)
Code:
requirejs(['fab/fabrik'], function() {

function updateList125() {
Fabrik.blocks.list_125_com_content_125.submit();
}
var interval = setInterval(updateList125, 5000);
});
is working without any error.
 
Thank you for taking time and testing it.

I dont know what is wrong at my end. I checked again at my site, but same error. Also set debugging to JS Burst and cleared cached.

My content plugin is placed in Custom Detail page of another Fabrik list with Menu option setting Row id = -1 and Key = userid. Didnt check in J! article.

Will do more testing and get back to you.
 
Checked with your settings (Details menu item with -1, list via content plugin in details intro) , no error, the list is reloading.
As I said: inspect your page source to find the correct HTML id.
 
Thank you once again.

It looks there is some issue at my server. I will create a new raw list and then do the testing to find out the issue.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top