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

"change:data.group_id" event doesn't work #29

Closed
atnartur opened this issue Mar 15, 2016 · 2 comments
Closed

"change:data.group_id" event doesn't work #29

atnartur opened this issue Mar 15, 2016 · 2 comments

Comments

@atnartur
Copy link
Contributor

Здравствуйте! Не срабатывают события по изменению вложенных в объект свойств.

class EditModal extends MK.Object{
    constructor(data) {
        super();
        this.jset({
            data: {
                group_id: ''
            }
        });;

        this.bindNode({
            'data.group_id': ':sandbox select[name=group_id]'
        }, {
            setValue: (v) => {
                $(this).val(v);
            }
        });

        var self = this;

        this.on('change:data.group_id', function(){
            console.log(111)
        });
    }
}

Есть data.group_id. Поле привязано к тегу <select>. По изменению <select> в консоль должен попадать определенный текст, но этого не происходит.

Повторил на Codepen

@zveroboy
Copy link

@atnartur, посмотрите на Хабре Пример 7.
Для Вашего случая правильным будет следующий вариант:

this.on('data@change:group_id', function(){ console.log(111); });

Codepen

@finom
Copy link
Owner

finom commented Mar 31, 2016

@atnartur change:data.group_id будет слушать изменения в свойстве this["data.group_id"]. @zveroboy прав.

@finom finom closed this as completed Mar 31, 2016
@finom finom changed the title Не срабатывают события по изменению вложенных в объект свойств "change:data.group_id" event doesn't work Mar 31, 2016
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

3 participants