⚠ 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

datebase column Comments as hints



ezgoen

ezgoen
  • profile picture
  • Member

Posted 18 April 2013 - 03:36 AM

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)
and 
 
$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;
 

 

add the following line
 

 

$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??


davidoster

davidoster
  • profile picture
  • Member

Posted 18 April 2013 - 08:30 AM

Easy peasy! Thanks for this!


Arianreige

Arianreige
  • profile picture
  • Member

Posted 13 January 2017 - 02:36 AM

шутеры от первого лица на пк 2014 доверенность на получение денежных средств в банке музыку зажигательные танцевальные хиты мод на майнкрафт 1.6.4 на сумеречный лес игры для девочек монстр хай одевалки бесплатные игры для windows 7 на русском языке танцевальную русскую музыку джамайка в хорошем качестве все серии анекдоты про наркоманов от трахтенберга купала ивана купала волшебники двора моя говорящая анжела на телефон андроид форма-4 фсс от 11.02.2014 94н наталья щерба быть ведьмой fb2 сидоров рисунок старых русских мастеров музыку по алфавиту украинские [url=http://xenla.ru/ljpqs7y/?p=976]сердечно-сосудистая хирургия учебник[/url] [url=http://xenla.ru/we9xk19s/?p=69]музыку сергея прокофьева[/url] [url=http://xenla.ru/4p4cy7ms/?p=161]презентация английские колонии в северной америке[/url] [url=http://xenla.ru/y6sfi/?p=193]3d клипы для телевизора[/url] [url=http://xenla.ru/ho7izx725/?p=892]подскажите где книгу на 50 оттенков темнее[/url] [url=http://xenla.ru/vd2z04ms/?p=199]я сталкер рождение зоны андрей левицкий[/url] [url=http://xenla.ru/gncfvf9/?p=62]аудиокнигу круз андрей выживатель[/url] [url=http://xenla.ru/bl6sd/?p=592]bruin professional br 1000 инструкции[/url] [url=http://xenla.ru/7ed7a7k3/?p=77]песни из мультфильма анастасия[/url] [url=http://xenla.ru/23gqct/?p=660]игру майнкрафт на виндовс 8.1[/url] [url=http://xenla.ru/ejgwnlmpf/?p=434]драйвера на видеокарту palit gt 430[/url] [url=http://xenla.ru/eb027eb92/?p=588]матвеева т.ю. введение в макроэкономику[/url] [url=http://xenla.ru/tx0ezjl/?p=747]руководство по эксплуатации и ремонту мазда мпв[/url] [url=http://xenla.ru/c972w8m/?p=264]друскин фортепианные концерты бетховена[/url] [url=http://xenla.ru/fj70vb4zf/?p=317]игру dumb ways to die на компьютер[/url]