• New Commercial Services Section

    We have now opened a commercial services section here on the forum. If you have a Fabrik project that you wish to have someone work on for you, post it under Help Wanted. If you are an application developer and wish to earn some money helping others, post your details under Fabrik Application Developers.

    Both of these are unmoderated. It will be up to both parties to work out the details and come to an agreement.

How to Make a calc element like lazy load

ritesh123

Member
Hi All

I am using cal element in my List View
My PHP code is quite complex and takes time to fetch the information, which i feel is perfectly fine.

But when i load my list view the whole page takes lots of time. In my List View i am showing 10 rows.
So for each page with 10 rows the calculation happens and thats the reason it takes lot of time.

How can make make my code in cal element like a lazy load. So that when i load the list view it loads fast and in behind the scene the PHP code will run and the value shows up when the php code runs.

Any example will be greatly appreciated.

Thanks
 
Well, firstly, does your calc need to load when the list loads? Can it not just run when the form is submitted?

Secondly, complex things generally aren't good for doing in a calc. It was designed to do really simple, quick stuff. Complex tasks are usually best done with a form submission script, and (if necessary) a list_events script running onLoad, to pre-populate row data.

-- hugh
 
Hi

Thanks for your reply. In my List View i am not showing any detailed View OR Form Edit. There is no notion of form submission by user.
The Status is controlled by user by using other buttons in List View. They Say Status as "Start" or "Stop" via 2 buttons in List View.

I am just showing List View.
One of the Field/element in List View is "Status" This "Status" is running a PHP Script which grabs status of various workflows from other MySQL based system and shows up the value here. ( Start/Stop)

You can imagine a List View with the status. That is the reason i need here ajax or lazy load.Once i load the whole List View Page, the code for 10 rows runs and Loads the whole List View in close to 25-30 sec, which is too long.

Please let me know if this possible or you have some example code.

Thanks
 
In element settings->List view settings->Include in list query set to "no" for elements, for which data is not needed in the list.
 
IF your "Status" field is calc element you can change it to field element and pre-populate your data with php script running onLoad through list_events (as Hugh suggested).
In your php code you can run only one complex query to get all needed status data and store in your "Status" field.
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top