This one was real easy folks - so I'll pass it on
Maybe someone will attach some JS or jQuery so they pop up or something??
anyhow this is how I did it, it was sooooo easy.
Create a custom GC MODEL
copy the code for
get_field_types_basic_table()
code from grocery_crud_model into it
then make the following changes
function get_field_types_basic_table() { $db_field_types = array(); //change this.. //foreach($this->db->query("SHOW COLUMNS FROM `{$this->table_name}`")->result() as $db_field_type) //to this foreach($this->db->query("SHOW FULL COLUMNS FROM `{$this->table_name}`")->result() as $db_field_type)
$db_field_types[$db_field_type->Field]['db_max_length'] = $length; $db_field_types[$db_field_type->Field]['db_type'] = $db_type; $db_field_types[$db_field_type->Field]['db_null'] = $db_field_type->Null == 'YES' ? true : false; $db_field_types[$db_field_type->Field]['db_extra'] = $db_field_type->Extra;
$db_field_types[$db_field_type->Field]['db_comment'] = $db_field_type->Comment;
Thats it - now just change your theme files edit.php and add.php
here's my change to /assets/grocerycrud/flexigrid/views/edit.php
<div class='form-field-box <?php echo $even_odd?>' id="<?php echo $field->field_name; ?>_field_box"> <div class='form-display-as-box' id="<?php echo $field->field_name; ?>_display_as_box"> <?php echo $input_fields[$field->field_name]->display_as?><?php echo ($input_fields[$field->field_name]->required)? "<span class='required'>*</span> " : ""?> : </div> <div class='form-input-box' id="<?php echo $field->field_name; ?>_input_box"> <?php echo $input_fields[$field->field_name]->input?> <?php // **********My Changes**************************************************************************** ?> <div class='form_hint_box' id="<?php echo $field->field_name; ?>_hint_box"> <?php echo $input_fields[$field->field_name]->db_comment?> </div> <?php // ************************************************************************************** ?> </div> <div class='clear'></div> </div>
I also added the following to flexigrid.css
.form_hint_box { padding: 5px 5px; margin: 0px 0px 0px 0px; font-size:7px; }
Thats it - no go back and put nice comments into your mysql column definitions
and you'll have them show up on the add & edit forms.
I'm sure the idea could be easily incorperated into core gc at which time I'm sure someone will come up with a language file mechanism for it too .
Cheers
Enjoy
PS - sometimes code tags here in the forum throw some of the code outside them - dunno why??