Jump to content

Error on sorting relation_n_n column in flexigrid

  • Please log in to reply
3 replies to this topic

#1 lherlaar



  • Members
  • PipPip
  • 19 posts

Posted 10 May 2012 - 10:49 AM


When I click on the column header of a relation_n_n field to sort on that column in the flexigrid list view, I'm getting this error:

Fatal error: Call to a member function result() on a non-object in /Users/.../application/models/grocery_crud_model.php on line 71

The line in the model of my version ( that gives the error is:

$results = $this->db->get($this->table_name)->result();

The error message keeps coming back until I clear my browser cookies.

To see the issue, I used the following code in my controller, which creates just a basis list with only an n_n relation as an extra:

function bugtest() {

$this->grocery_crud->set_relation_n_n('onderdeel', 'beheerders_onderdelen', 'onderdelen', 'pkid_beheerders', 'pkid_onderdelen', 'onderdeel');

$output = $this->grocery_crud->render();

Sorting all other columns works as expected (until I get the error message, then I need to clear my cookies).

Any idea on what might be wrong?


(BTW I would've liked to include a screenshot but the uploader is complaining about having reached my global upload quota of 500kb...)

#2 jcasanova


    Advanced Member

  • Members
  • PipPipPip
  • 61 posts

Posted 10 May 2012 - 07:28 PM

I got a different error on sorting with relation_n_n and "display_as"

re relation has a name (is not a field) and when try to sort, GC tried to use the name instead of the field to do the order by



Is it possible to turn off the sorting, like $crud->unset_jquery() ?

#3 web-johnny


    grocery CRUD Author

  • Administrators
  • 1,155 posts
  • LocationLondon

Posted 11 May 2012 - 06:46 AM

This bug is fixed for the new version 1.2.2 ( https://github.com/s...-crud/issues/13 ) , both for search and for ordering. You can download it directly from github at https://github.com/s.../zipball/master
Posted Image

#4 jcasanova


    Advanced Member

  • Members
  • PipPipPip
  • 61 posts

Posted 11 May 2012 - 01:09 PM

change log for 1.2.2 looks very nice.

Good work!

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users