dudapiotr / ZfTable

*Not supported*ZfTable 3.1. Awesome ZF2 table / grid (and much much more) generator with huge possibilities of decorating and conditioning. Integrated with DataTables, Doctrine 2, Bootstrap 2.0 and 3.0.
http://dudapiotrek.laohost.net/
MIT License
75 stars 59 forks source link

Date support #25

Closed ionutfechete closed 10 years ago

ionutfechete commented 10 years ago

Is there support for converting timestamps from database to something like date('Y-m-d', $time); in zfTable? Also, how can I build a dropdown (e.g. for checking if, for example a value in the form is 0, then select an option from the dropdown, if is 1 select another, but the select has to be in every cell of the column of the table)? Thanks a lot!

ionutfechete commented 10 years ago

fixed it by using custom template..but maybe there is a filter..still awaiting response..thanks!

dudapiotr commented 10 years ago

Hi, Ad1. There are two possibilities:

  1. Modify Your sql. e.g.:
'date_accepted' => new Zend_Db_Expr("TO_CHAR(date_accepted, 'MM/YYYY')"),
  1. Use callable decorator
public function init()
    {
        $this->getHeader('time')->getCell()->addDecorator('callable', array(
            'callable' => function($context, $record){
                return date('Y-m-d', $record['time'])
            }
        ));
    }

Ad2. Could You more explain Your problem. Maybe You think about sending additional param like this:

http://dudapiotr.eu/table/additional-params

ionutfechete commented 10 years ago

hi, I finally used a custom template, and it worked! Thanks for the answer!

wongfox commented 8 years ago

could by like this code with bootstrap 3 datepicker

<script>                                
      $("#tableContainer").zfTable('cheque', {
             complete: function () {
                  $("input[name='zff_Date']").delay(800).datepicker({
                           format: 'yyyy-mm-dd'
                   }).on('changeDate', function (e) {
                            $(this).datepicker('hide');
                    });
              }
      });
</script>