⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

set_relation_n_n lines row limit render



MasterMosquiton
  • profile picture
  • Member

Posted 11 November 2011 - 11:24 AM

Hi,

i have a question about set_relation_n_n function and rendering of the results.

The scenary is a blog about movies, just same as your example.

My code is something like this


$crud->set_theme('datatables');
$crud->set_table('movies');

$crud->set_relation_n_n('actors', 'people_movies', 'people', 'movie_id', 'people_id', 'name', 'role')->where('role','regista');
$crud->set_relation_n_n('categorie', 'categories_movies', 'categories', 'movie_id', 'category_id', 'name');
$crud->fields('title', 'actors', 'categorie');
$output = $crud->render();


People table counts is 5k+ rows, Movies table count is 400+ rows, Categories table count is 20 rows.
Join query between categories, movies and peoples took about 0,002 sec on my database, so it's not a db issue.
My problem is that when the browser try to render the page, a script in the page send the browser in timeout.

My personal opinion is : the array passed to the javascript function that render the multi-select for actors is too big with 5k+ lines and the script goes in block.

What do you think about it?

Thanks in advance for your answer, and sorry for my bad english.

Pietro

crina
  • profile picture
  • Member

Posted 02 March 2012 - 07:37 AM

Hello,

The only thing I can think about, in solving this problem is to make the page load using AJAX, and put a spinner in the page until the whole page loads (all the data and all the scripts) ...
I have encountered the same problem ... and I am planning to implement this ... but maybe only in a few days, now I have other issues to take care ...

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 03 March 2012 - 11:13 AM

Hello there,

Don't worry about it . I will try to include this functionality to the next version.I will do my best to add it. And it is simple , just after a limitation for example 500 rows grocery CRUD will change the input automatically to ajax . I already start with this but it needs lot of work, so please be patient with this feature. I will also have the same feature for the simple set_relation also.