What's new

Welcome to xCrud Community - Data Management and extended PHP CRUD

Join us now to get access to all our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, and so, so much more. It's also quick and totally free, so what are you waiting for?

SOLVED How to access the grid's result_list ?

ben74

New member
Joined
Dec 13, 2021
Messages
20
Reaction score
5
Points
3
Location
France
Hello,

In a scenario I need to access the result_list of an xcrud instance. I've tried using:
PHP:
$xcrud_dyn = Xcrud::get_instance();

// ...

// later on:
$array_of_results_array = $xcrud_dyn->result_list;
foreach ($array_of_results_array as $single_result_array) {
    // do stuff
}


But I get an error message:

Fatal error: Uncaught Error: Cannot access protected property Xcrud::$result_list

I simply need to loop over the array of array to create a CSV string of some rows column matching a condition.

Any idea how to do this?

The docs say:

$this->result_list​

Array of arrays with full result from database (grid). You can use it to create your own grid rendering.

so I don't really understand why it doesn't work in my script.

Thanks a lot
 

ben74

New member
Joined
Dec 13, 2021
Messages
20
Reaction score
5
Points
3
Location
France
OK so apparently the only way access the result_list is by creating a custom template view... in which case $this->result_list is filled with the expected content.
 
Top Bottom