Error on sorting relation_n_n column in flexigrid
- Single Page
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:
[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...)
Posted 10 May 2012 - 19:28 PM
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() ?
Posted 11 May 2012 - 06:46 AM
Posted 11 May 2012 - 13:09 PM
Good work!