⚠ 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

Error on sorting relation_n_n column in flexigrid



lherlaar
  • profile picture
  • Member

Posted 10 May 2012 - 10:49 AM

Hi,

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:

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

The line in the model of my version (1.2.1.1) 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_table('beheerders');

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

$output = $this->grocery_crud->render();
$this->load->view('bugtest.php',$output);
}

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?

Thanks!

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

jcasanova
  • profile picture
  • Member

Posted 10 May 2012 - 19: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


$crud->set_relation_n_n('grupos','users_groups','groups','user_id','group_id','description');


[attachment=171:relation_n_n.jpg]


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

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

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/scoumbourdis/grocery-crud/zipball/master

jcasanova
  • profile picture
  • Member

Posted 11 May 2012 - 13:09 PM

change log for 1.2.2 looks very nice.

Good work!