Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not paint days in the widget? #4

Open
component6 opened this issue Feb 10, 2017 · 3 comments
Open

Not paint days in the widget? #4

component6 opened this issue Feb 10, 2017 · 3 comments

Comments

@component6
Copy link

Good afternoon. I am interested in your package, but I have difficulty in using it, you could not give answers to my questions.
When you try to run ActiveCalendar widget and render it in the data model of the Service, data is not displayed.
I did the settings for your example. Calendar rendered, but for some reason does not render lannye that I bring to it. The widget is drawn, only the current date. But a month in advance. (10 March 2017)
model description "Service"

class Service extends \yii\db\ActiveRecord implements DataItem {
    public function rules() {
        return [
            [['name'], 'required'],
            [['date_begin', 'date_end'], 'safe'],
            [['date_begin', 'date_end'], 'default', 'value' => function ($model, $attribute) {
                return '0000-00-00 00:00:00';
            }],
        ];
    }
    public function getName() {
        return $this->name;
    }
    public function getStartDate() {
        return JsExpressionHelper::parse(time($this->date_begin));
    }
    public function getEndDate()
    {
        return JsExpressionHelper::parse(time($this->date_end));
    }
}

Further, as I called widget:

echo ActiveCalendar::widget([
    'language' => 'ru',
    'dataProvider' => new ActiveDataProvider([
        'query' => Service::find()->andWhere(['disposable' => 1])
    ]),
    'options' => [
        'id' => 'calendar',
        'class' => 'calendar',
        'tag' => 'div',
    ],
    'clientOptions' => [
        'contextMenuItems' => true,
        'style' => 'background',
        // 'customDayRenderer' => '',
        // 'customDataSourceRenderer' => '',
    ],
    'clientEvents' => [
        'clickDay' => 'function(e) { alert(); }',
    ]
]);

Here's what I got:
2017-02-10 14-21-05
The widget does not display data from ActiveDataProvider.
At the most there html page javascript code:

<script type="text/javascript">
jQuery(document).ready(function () {
    jQuery('#calendar').calendar({
        "contextMenuItems":true,
        "style":"background",
        "dataSource":[
        {
            "id":100,
            "name":"name 1",
            "disposable":1,
            "startDate":new Date(2017, 02, 10),
            "endDate":new Date(2017, 02, 10)
        },
        {
            "id":108,
            "name":"name 2",
            "disposable":1,
            "startDate":new Date(2017, 02, 10),
            "endDate":new Date(2017, 02, 10)
        }
        ],
        "language":"ru"
    });
});
</script>

For some reason, he does not draw the days of the widget?
Please tell me what I'm doing wrong?

##############################
Добрый день. Меня заинтересовал ваш пакет, но я испытываю трудности в его использовании, не могли бы вы дать ответы на мои вопросы.
При попытке запустить виджет ActiveCalendar и отрисовать в нем данные из модели Service, данные не отображаются.

Я делал настройки по вашему примеру. Календарь отрисовался, но по каким то причинам не отрисовались ланные, которые я в него передаю. В виджете отрисовывается только текущяя дата. Но на месяц вперед. (10 марта 2017 года)

описание модели "Service": (описано выше...)

Далее, в виде я вызвал виджет: (описано выше...)

Вот что у меня получилось:
2017-02-10 14-21-05

В виджете не отобразились данные из ActiveDataProvider.
На самой html странице есть javascript код: (описано выше...)

По каким то причинам он не отрисовывает дни в виджете?
Пожалуйста подскажите, что я делаю не так?

@Faryshta
Copy link
Member

hi, i don't understand the issue. is the widget rendering the items a month after the date they are supposed to appear?

@component6
Copy link
Author

does not display data

"dataSource":[
        {
            "id":100,
            "name":"name 1",
            "disposable":1,
            "startDate":new Date(2017, 02, 10),
            "endDate":new Date(2017, 02, 10)
        },
        {
            "id":108,
            "name":"name 2",
            "disposable":1,
            "startDate":new Date(2017, 02, 10),
            "endDate":new Date(2017, 02, 10)
        }
....

should be displayed as here http://www.bootstrap-year-calendar.com/#Examples/Full example

@Faryshta
Copy link
Member

Faryshta commented Apr 4, 2017

can you try

    public function getStartDate() {
        return JsExpressionHelper::parse($this->date_begin);
    }
    public function getEndDate()
    {
        return JsExpressionHelper::parse($this->date_end);
    }

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

No branches or pull requests

2 participants