ajax_list - 500 error. Sort problem?
- Single Page
Posted 11 April 2012 - 18:24 PM
First of all, am loving Grocery CRUD - is saving a lot of tedious work!
However, I do have a problem. Basically, it seems that if I perform a sort on any column in any table, and then move to a different table, I get a 500 Internal Server error and cannot move between pages, or search. If I go back to the table on which I originally performed the sort it behaves, and I get no error. Also, if I sort a new table then it is ok on that table, until I move to a different table.
It seems only to be after sorting that I get it. I can go between pages of a CRUD table, I can do searches and all is well but as soon as I do a sort I get errors on other tables, until I do a sort on them!
Bit hard to explain - hope the above is ok.
csrf_protection is set to false.
Here is an example Firebug output (ps - how come do I not see the error output below in browser?);
<!DOCTYPE html>
<html lang="en">
<head>
<title>Database Error</title>
<style type="text/css">
[removed by poster]
</style>
</head>
<body>
<div id="container">
<h1>A Database Error Occurred</h1>
<p>Error Number: 1054</p><p>Unknown column 'audit_table' in 'order clause'</p><p>SELECT admin_clients_roi.*, j306051cf.roi_type_label as s306051cf
FROM (`admin_clients_roi`)
LEFT JOIN `admin_roi_types` as j306051cf ON `j306051cf`.`roi_type_id` = `admin_clients_roi`.`roi_type`
ORDER BY `audit_table` asc
LIMIT 10</p><p>Filename: C:\Websites\proj0017\system\database\DB_driver.php</p><p>Line Number: 330</p> </div>
</body>
</html>
Thanks in advance,
Geoff
Posted 11 April 2012 - 21:46 PM
If you don't use then it is weird as I don't think there is a bug with the ordering. Can you please tell me if the [color=#282828][font=helvetica, arial, sans-serif]audit_table exists at your columns? Or it is a field from a different crud table? [/font][/color]
Posted 12 April 2012 - 07:32 AM
public function table($tbl)
{
// Add prefix to table name to make real table name
$tbl = "admin_$tbl";
// Get the client's db settings from file referenced in session data
require $this->session->userdata('client_db');
$this->load->database($client_db);
$this->grocery_crud->set_table($tbl);
// Put table name in session data for the view to access
$this->session->set_userdata('table', $tbl);
// Check for table specific options
$this->crud_options($tbl);
// Callbacks to write to audit table
$this->grocery_crud->callback_before_insert(array($this, 'audit_insert'));
// Writing delete / undelete operations is now called from custom delete function
$this->grocery_crud->callback_before_update(array($this, 'audit_update'));
// Over-ride delete function to hide record instead, also hide deleted column
$this->grocery_crud->callback_delete(array($this, 'delete'));
// $this->grocery_crud->unset_columns('deleted');
$data = $this->grocery_crud->render();
$this->load->view('client_admin/gcrud', $data);
}
Posted 12 April 2012 - 08:07 AM
/*
var cookie_crud_page = readCookie('crud_page_'+unique_hash);
var cookie_per_page = readCookie('per_page_'+unique_hash);
var hidden_ordering = readCookie('hidden_ordering_'+unique_hash);
var hidden_sorting = readCookie('hidden_sorting_'+unique_hash);
var cookie_search_text = readCookie('search_text_'+unique_hash);
var cookie_search_field = readCookie('search_field_'+unique_hash);
if(cookie_crud_page !== null && cookie_per_page !== null)
{
$('#crud_page').val(cookie_crud_page);
$('#per_page').val(cookie_per_page);
$('#hidden-ordering').val(hidden_ordering);
$('#hidden-sorting').val(hidden_sorting);
$('#search_text').val(cookie_search_text);
$('#search_field').val(cookie_search_field);
if(cookie_search_text !== '')
$('#quickSearchButton').trigger('click');
$('#filtering_form').trigger('submit');
}
*/
Posted 12 April 2012 - 08:58 AM
Posted 13 April 2012 - 13:46 PM
great!
Johnny GREAT work!
Posted 02 May 2012 - 15:36 PM
but what about the datatables theme? how can i [color=#282828][font=helvetica, arial, sans-serif]disable the cookie for the datatables theme?[/font][/color]
thank you in advance.
Posted 02 May 2012 - 18:43 PM
bStateSave": true,
to
bStateSave": false,
Posted 03 May 2012 - 04:46 AM
thanks for the good things
Posted 29 August 2012 - 07:02 AM
$crud = new grocery_CRUD();
$crud->set_theme('flexigrid');
$crud->set_table('order');
$crud->columns('orderId', 'orderCust', 'orderDate', 'orderStatus');
$crud->change_field_type('orderId','readonly');
$crud->change_field_type('orderDiscount','hidden');
$crud->change_field_type('orderTax','hidden');
$crud->set_relation('orderCust', 'customer', 'custName');
$crud->set_relation('orderStatus', 'orderStatus', 'osStatus');
$crud->set_relation('orderType', 'orderType', 'otType');
$crud->display_as('ordeId','Order Number');
$crud->unset_edit();
$crud->unset_add();
$crud->add_action('Update Bill', base_url().'images/bill.png', 'welcome/editSoulBill');
$output = $crud->render();
$data['title'] = "Manage Products";
$data['logdIn'] = true;
$output = array_merge($data,(array)$output);
$this->_outputData($output);
when i delete the record it does not FADEOFF
the error is
[quote]
[b]A Database Error Occurred[/b]
Error Number: 1054
Unknown column 'order.osStatus'please help in 'order clause'
SELECT `order`.*, j614d97e6.custName AS s614d97e6, jc52a1db8.osStatus AS sc52a1db8, j12b62433.otType AS s12b62433
FROM (`order`)
LEFT JOIN `customer` as j614d97e6 ON `j614d97e6`.`custId` = `order`.`orderCust`
LEFT JOIN `orderStatus` as jc52a1db8 ON `jc52a1db8`.`osId` = `order`.`orderStatus`
LEFT JOIN `orderType` as j12b62433 ON `j12b62433`.`otId` = `order`.`orderType`
ORDER BY `order`.`osStatus` asc
LIMIT 25
Filename: /var/www/pioneer/models/grocery_crud_model.php
Line Number: 93
[/quote]
[size=6]WORKS WELL, Solution was Jhonny's comment number #4[/size]