Jump to content


saulimus

Member Since 11 Jul 2012
Offline Last Active Mar 27 2013 12:07 PM
-----

Topics I've Started

Redundant database queries

18 October 2012 - 10:57 AM

Hi,
I was just profiling my CodeIgniter app and noticed that GroceryCrud queries the database many times for the table set with set_table():

SHOW COLUMNS FROM `some_table` (6 * 0.0150s = 0.09s)
DESCRIBE `some_table` (5 * 0.0091s = 0.0455s)
Total time taken: 0.1355s

You could get better performance if you only queried once and saved the results...
Another method would be to provide a function that could be used to give table info without querying the server. Or... how about providing a way to cache the table schema somehow; then the developer would simply update the cache each time he changes something in the database. (Maybe just daydreaming here... :))

Unsigned number field bug

28 September 2012 - 12:40 PM

I have a column in the database with datatype INT, unsigned.
In edit/add mode, Gcrud creates an input element like this:
<input id="field-testinteger" name="testinteger" type="text" value="51256" class="numeric" maxlength="10) unsigne"/>
The maxlength is all messed up... in my browser (Opera) this makes one unable to use backspace.
The problem probably lies in the model, function get_field_types_basic_table() ...where it tries to find the db_max_length.

set_relation and callbacks don't work

07 September 2012 - 12:01 PM

If I try to use a callback with a column (haven't tried a field yet) that has a relation, the callback doesn't work.
Add the following lines to the GC 1.3.1 examples controller to see the bug in action:
function employees_management()
{
...
	$crud->callback_column('officeCode', array($this, '_callback_test'));
...
}

function _callback_test($value, $row)
{
	return 'test';
}

You can easily see that it should work by uncommenting the set_relation('officeCode'...) line.

Update:
Array $this->callback_column includes 'officeCode' but function change_list() is looking for the unique field value like 'se95a0e4e'... because get_columns() has changed the field name to the unique value.

Suggestion: only update changed data

05 September 2012 - 06:37 AM

Hopefully this is the right forum for this...
Just came across a nice feature in nuBuilder:

4. Full Multiple User Support

To avoid two or more users overwriting the same record nuBuilder only updates the fields on a record that have been changed. For example if 2 users have open the same customer record at the same time, with one user changing the customer's phone number and the other user changing the address, only the changes they make will be saved to ensure data integrity.

http://www.nubuilder...?nav=Philosophy

This would be a nice feature for GroceryCrud, don't you think? :)
Another check one could implement is to query the database before update and see if the value shown to the user differs from the one in the database. If it differs, notify the user that someone else has changed the value...

Edit: A method that uses a separate column last_updated for checking:
http://codeigniter.c...ewreply/774723/
GC could check for the existence of such a column and automatically use it for this purpose?...

jQuery 1.8.0 and TinyMCE + jQuery UI Chosen

31 August 2012 - 12:38 PM

Edit: Found a solution, see post #3

Hi,

I found that TinyMCE and jQuery 1.8.0 don't like to work together...
This causes select dropdowns to stop working in the add/edit form.

How to replicate:
Use GroceryCrud 1.3.
Use TinyMCE for a column and try select values using dropdowns.