Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

Problem in date preview in Cgridview as I am using afterFind() and beforeSave() methods in model. #120

Open
Khan143 opened this issue Sep 12, 2014 · 1 comment

Comments

@Khan143
Copy link

Khan143 commented Sep 12, 2014

I am using this extension and it works good. but when I change the date then as it is updated in the database, but on the gridview field it is not displaying.
I am using beforeSave() and afterFind() methods of yii in my model. as bellow

protected function beforeSave() {
        if (parent::beforeSave()) {
            if ($this->isNewRecord) {
                $this->dob= date('Y-m-d', strtotime($this->dob));
                return true;
            } else {
                $this->dob= date('Y-m-d', strtotime($this->dob));

                return true;
            }
        } else
            return false;
    }

protected function afterFind() {        
        if (strtotime($this->dob) != 0)
            $this->dob= XHtml::formatDate($this->dob);
        else
            $this->dob= '';

        return TRUE;
    }

So how can I solve my problem.
Also the datepicker range is from 2004-2024 is the issue that how to increase this range.
Also, I want to use the select field, but the values of the select dropdown should be numbers from 1-10 and that numbers should be in an array, which I can then saved it to the database.

@Julian-B90
Copy link
Collaborator

Do you currently still have the problem?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants